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;
273 case 3: return LDKNetwork_Signet;
277 static jclass LDKNetwork_class = NULL;
278 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
279 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
280 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
281 static jfieldID LDKNetwork_LDKNetwork_Signet = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
283 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
284 CHECK(LDKNetwork_class != NULL);
285 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
286 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
287 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
288 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
289 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
290 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
291 LDKNetwork_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Signet", "Lorg/ldk/enums/LDKNetwork;");
292 CHECK(LDKNetwork_LDKNetwork_Signet != NULL);
294 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
296 case LDKNetwork_Bitcoin:
297 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
298 case LDKNetwork_Testnet:
299 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
300 case LDKNetwork_Regtest:
301 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
302 case LDKNetwork_Signet:
303 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Signet);
308 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
309 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
310 case 0: return LDKSecp256k1Error_IncorrectSignature;
311 case 1: return LDKSecp256k1Error_InvalidMessage;
312 case 2: return LDKSecp256k1Error_InvalidPublicKey;
313 case 3: return LDKSecp256k1Error_InvalidSignature;
314 case 4: return LDKSecp256k1Error_InvalidSecretKey;
315 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
316 case 6: return LDKSecp256k1Error_InvalidTweak;
317 case 7: return LDKSecp256k1Error_TweakCheckFailed;
318 case 8: return LDKSecp256k1Error_NotEnoughMemory;
322 static jclass LDKSecp256k1Error_class = NULL;
323 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
324 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
325 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
326 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
327 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
328 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
329 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
330 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
331 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
333 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
334 CHECK(LDKSecp256k1Error_class != NULL);
335 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
336 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
337 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
338 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
339 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
340 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
341 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
342 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
343 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
344 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
345 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
346 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
347 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
348 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
349 LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/LDKSecp256k1Error;");
350 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
351 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
352 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
354 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
356 case LDKSecp256k1Error_IncorrectSignature:
357 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
358 case LDKSecp256k1Error_InvalidMessage:
359 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
360 case LDKSecp256k1Error_InvalidPublicKey:
361 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
362 case LDKSecp256k1Error_InvalidSignature:
363 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
364 case LDKSecp256k1Error_InvalidSecretKey:
365 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
366 case LDKSecp256k1Error_InvalidRecoveryId:
367 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
368 case LDKSecp256k1Error_InvalidTweak:
369 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
370 case LDKSecp256k1Error_TweakCheckFailed:
371 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
372 case LDKSecp256k1Error_NotEnoughMemory:
373 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
379 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
380 ret->datalen = (*env)->GetArrayLength(env, elems);
381 if (ret->datalen == 0) {
384 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
385 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
386 for (size_t i = 0; i < ret->datalen; i++) {
387 ret->data[i] = java_elems[i];
389 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
393 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
394 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
395 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
399 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
402 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
403 CHECK(val->result_ok);
404 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
405 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
408 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
409 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
410 CHECK(!val->result_ok);
411 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
415 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
418 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
419 CHECK(val->result_ok);
420 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
421 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
425 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
426 CHECK(!val->result_ok);
427 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
431 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
434 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
435 CHECK(val->result_ok);
436 LDKTxCreationKeys res_var = (*val->contents.result);
437 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
438 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
439 long res_ref = (long)res_var.inner & ~1;
442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
443 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
444 CHECK(!val->result_ok);
445 LDKDecodeError err_var = (*val->contents.err);
446 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
447 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
448 long err_ref = (long)err_var.inner & ~1;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
452 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
455 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
456 CHECK(val->result_ok);
457 LDKChannelPublicKeys res_var = (*val->contents.result);
458 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
459 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
460 long res_ref = (long)res_var.inner & ~1;
463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
464 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
465 CHECK(!val->result_ok);
466 LDKDecodeError err_var = (*val->contents.err);
467 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
468 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
469 long err_ref = (long)err_var.inner & ~1;
472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
473 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
476 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
477 CHECK(val->result_ok);
478 LDKTxCreationKeys res_var = (*val->contents.result);
479 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
480 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
481 long res_ref = (long)res_var.inner & ~1;
484 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
485 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
486 CHECK(!val->result_ok);
487 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
491 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
494 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
495 CHECK(val->result_ok);
496 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
497 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
498 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
499 long res_ref = (long)res_var.inner & ~1;
502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
503 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
504 CHECK(!val->result_ok);
505 LDKDecodeError err_var = (*val->contents.err);
506 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
507 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
508 long err_ref = (long)err_var.inner & ~1;
511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
512 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
515 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
516 CHECK(val->result_ok);
517 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
518 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
519 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
520 long res_ref = (long)res_var.inner & ~1;
523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
524 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
525 CHECK(!val->result_ok);
526 LDKDecodeError err_var = (*val->contents.err);
527 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
528 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
529 long err_ref = (long)err_var.inner & ~1;
532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
533 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
536 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
537 CHECK(val->result_ok);
538 LDKChannelTransactionParameters res_var = (*val->contents.result);
539 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
540 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
541 long res_ref = (long)res_var.inner & ~1;
544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
545 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
546 CHECK(!val->result_ok);
547 LDKDecodeError err_var = (*val->contents.err);
548 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
549 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
550 long err_ref = (long)err_var.inner & ~1;
553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
554 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
557 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
558 CHECK(val->result_ok);
559 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
560 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
561 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
562 long res_ref = (long)res_var.inner & ~1;
565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
566 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
567 CHECK(!val->result_ok);
568 LDKDecodeError err_var = (*val->contents.err);
569 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
570 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
571 long err_ref = (long)err_var.inner & ~1;
574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
575 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
578 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
579 CHECK(val->result_ok);
580 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
581 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
582 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
583 long res_ref = (long)res_var.inner & ~1;
586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
587 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
588 CHECK(!val->result_ok);
589 LDKDecodeError err_var = (*val->contents.err);
590 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
591 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
592 long err_ref = (long)err_var.inner & ~1;
595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
596 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
599 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
600 CHECK(val->result_ok);
601 LDKCommitmentTransaction res_var = (*val->contents.result);
602 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
603 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
604 long res_ref = (long)res_var.inner & ~1;
607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
608 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
609 CHECK(!val->result_ok);
610 LDKDecodeError err_var = (*val->contents.err);
611 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
612 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
613 long err_ref = (long)err_var.inner & ~1;
616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
617 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
620 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
621 CHECK(val->result_ok);
622 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
623 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
624 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
625 long res_ref = (long)res_var.inner & ~1;
628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
629 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
630 CHECK(!val->result_ok);
631 return *val->contents.err;
633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
634 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
636 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
637 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
638 CHECK(val->result_ok);
639 LDKCVec_SignatureZ res_var = (*val->contents.result);
640 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
642 for (size_t i = 0; i < res_var.datalen; i++) {
643 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
644 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
645 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
650 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
651 CHECK(!val->result_ok);
652 return *val->contents.err;
654 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
655 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
656 static jclass LDKErrorAction_IgnoreError_class = NULL;
657 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
658 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
659 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
661 LDKErrorAction_DisconnectPeer_class =
662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
663 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
664 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
665 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
666 LDKErrorAction_IgnoreError_class =
667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
668 CHECK(LDKErrorAction_IgnoreError_class != NULL);
669 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
670 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
671 LDKErrorAction_SendErrorMessage_class =
672 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
673 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
674 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
675 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
677 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
678 LDKErrorAction *obj = (LDKErrorAction*)ptr;
680 case LDKErrorAction_DisconnectPeer: {
681 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
682 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
683 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
684 long msg_ref = (long)msg_var.inner & ~1;
685 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
687 case LDKErrorAction_IgnoreError: {
688 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
690 case LDKErrorAction_SendErrorMessage: {
691 LDKErrorMessage msg_var = obj->send_error_message.msg;
692 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
693 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
694 long msg_ref = (long)msg_var.inner & ~1;
695 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
700 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
701 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
702 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
703 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
704 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
705 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
707 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
708 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
709 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
710 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
711 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
712 LDKHTLCFailChannelUpdate_ChannelClosed_class =
713 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
714 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
715 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
716 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
717 LDKHTLCFailChannelUpdate_NodeFailure_class =
718 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
719 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
720 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
721 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
723 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
724 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
726 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
727 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
728 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
730 long msg_ref = (long)msg_var.inner & ~1;
731 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
733 case LDKHTLCFailChannelUpdate_ChannelClosed: {
734 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
736 case LDKHTLCFailChannelUpdate_NodeFailure: {
737 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
738 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
739 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
744 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
745 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
746 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
747 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
748 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
749 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
750 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
751 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
752 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
753 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
754 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
755 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
756 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
757 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
758 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
759 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
760 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
761 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
762 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
763 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
764 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
765 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
766 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
767 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
768 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
769 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
770 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
771 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
772 static jclass LDKMessageSendEvent_HandleError_class = NULL;
773 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
774 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
775 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
776 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
777 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
778 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
779 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
781 LDKMessageSendEvent_SendAcceptChannel_class =
782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
783 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
784 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
785 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
786 LDKMessageSendEvent_SendOpenChannel_class =
787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
788 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
789 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
790 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
791 LDKMessageSendEvent_SendFundingCreated_class =
792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
793 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
794 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
795 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
796 LDKMessageSendEvent_SendFundingSigned_class =
797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
798 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
799 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
800 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
801 LDKMessageSendEvent_SendFundingLocked_class =
802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
803 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
804 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
805 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
806 LDKMessageSendEvent_SendAnnouncementSignatures_class =
807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
808 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
809 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
810 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
811 LDKMessageSendEvent_UpdateHTLCs_class =
812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
813 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
814 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
815 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
816 LDKMessageSendEvent_SendRevokeAndACK_class =
817 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
818 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
819 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
820 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
821 LDKMessageSendEvent_SendClosingSigned_class =
822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
823 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
824 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
825 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
826 LDKMessageSendEvent_SendShutdown_class =
827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
828 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
829 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
830 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
831 LDKMessageSendEvent_SendChannelReestablish_class =
832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
833 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
834 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
835 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
836 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
838 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
839 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
840 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
841 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
843 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
844 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
845 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
846 LDKMessageSendEvent_BroadcastChannelUpdate_class =
847 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
848 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
849 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
850 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
851 LDKMessageSendEvent_HandleError_class =
852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
853 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
854 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
855 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
856 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
858 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
859 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
860 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
861 LDKMessageSendEvent_SendChannelRangeQuery_class =
862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
863 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
864 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
865 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
866 LDKMessageSendEvent_SendShortIdsQuery_class =
867 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
868 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
869 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
870 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
872 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
873 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
875 case LDKMessageSendEvent_SendAcceptChannel: {
876 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
877 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
878 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
879 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
880 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
881 long msg_ref = (long)msg_var.inner & ~1;
882 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
884 case LDKMessageSendEvent_SendOpenChannel: {
885 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
886 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
887 LDKOpenChannel msg_var = obj->send_open_channel.msg;
888 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
889 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
890 long msg_ref = (long)msg_var.inner & ~1;
891 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
893 case LDKMessageSendEvent_SendFundingCreated: {
894 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
895 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
896 LDKFundingCreated msg_var = obj->send_funding_created.msg;
897 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
898 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
899 long msg_ref = (long)msg_var.inner & ~1;
900 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
902 case LDKMessageSendEvent_SendFundingSigned: {
903 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
904 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
905 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
906 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
907 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
908 long msg_ref = (long)msg_var.inner & ~1;
909 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
911 case LDKMessageSendEvent_SendFundingLocked: {
912 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
913 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
914 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
915 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
916 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
917 long msg_ref = (long)msg_var.inner & ~1;
918 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
920 case LDKMessageSendEvent_SendAnnouncementSignatures: {
921 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
922 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
923 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
924 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
925 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
926 long msg_ref = (long)msg_var.inner & ~1;
927 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
929 case LDKMessageSendEvent_UpdateHTLCs: {
930 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
931 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
932 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
933 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
934 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
935 long updates_ref = (long)updates_var.inner & ~1;
936 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
938 case LDKMessageSendEvent_SendRevokeAndACK: {
939 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
940 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
941 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
942 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
943 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
944 long msg_ref = (long)msg_var.inner & ~1;
945 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
947 case LDKMessageSendEvent_SendClosingSigned: {
948 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
949 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
950 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
951 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
952 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
953 long msg_ref = (long)msg_var.inner & ~1;
954 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
956 case LDKMessageSendEvent_SendShutdown: {
957 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
958 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
959 LDKShutdown msg_var = obj->send_shutdown.msg;
960 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
961 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
962 long msg_ref = (long)msg_var.inner & ~1;
963 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
965 case LDKMessageSendEvent_SendChannelReestablish: {
966 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
967 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
968 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
969 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
970 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
971 long msg_ref = (long)msg_var.inner & ~1;
972 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
974 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
975 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
976 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
977 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
978 long msg_ref = (long)msg_var.inner & ~1;
979 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
980 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 long update_msg_ref = (long)update_msg_var.inner & ~1;
983 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
985 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
986 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
987 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
988 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
989 long msg_ref = (long)msg_var.inner & ~1;
990 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
992 case LDKMessageSendEvent_BroadcastChannelUpdate: {
993 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
994 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 long msg_ref = (long)msg_var.inner & ~1;
997 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
999 case LDKMessageSendEvent_HandleError: {
1000 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1001 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1002 long action_ref = ((long)&obj->handle_error.action) | 1;
1003 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1005 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1006 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1007 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1009 case LDKMessageSendEvent_SendChannelRangeQuery: {
1010 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1011 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1012 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1013 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1014 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1015 long msg_ref = (long)msg_var.inner & ~1;
1016 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1018 case LDKMessageSendEvent_SendShortIdsQuery: {
1019 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1020 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1021 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1022 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1023 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1024 long msg_ref = (long)msg_var.inner & ~1;
1025 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1031 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1032 ret->datalen = (*env)->GetArrayLength(env, elems);
1033 if (ret->datalen == 0) {
1036 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1037 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1038 for (size_t i = 0; i < ret->datalen; i++) {
1039 int64_t arr_elem = java_elems[i];
1040 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1041 FREE((void*)arr_elem);
1042 ret->data[i] = arr_elem_conv;
1044 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1048 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1049 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1050 for (size_t i = 0; i < ret.datalen; i++) {
1051 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1056 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1059 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1060 CHECK(val->result_ok);
1061 return *val->contents.result;
1063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1064 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1065 CHECK(!val->result_ok);
1066 LDKLightningError err_var = (*val->contents.err);
1067 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1068 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1069 long err_ref = (long)err_var.inner & ~1;
1072 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) {
1073 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1074 LDKChannelAnnouncement a_conv;
1075 a_conv.inner = (void*)(a & (~1));
1076 a_conv.is_owned = (a & 1) || (a == 0);
1077 a_conv = ChannelAnnouncement_clone(&a_conv);
1079 LDKChannelUpdate b_conv;
1080 b_conv.inner = (void*)(b & (~1));
1081 b_conv.is_owned = (b & 1) || (b == 0);
1082 b_conv = ChannelUpdate_clone(&b_conv);
1084 LDKChannelUpdate c_conv;
1085 c_conv.inner = (void*)(c & (~1));
1086 c_conv.is_owned = (c & 1) || (c == 0);
1087 c_conv = ChannelUpdate_clone(&c_conv);
1091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1092 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1093 LDKChannelAnnouncement a_var = tuple->a;
1094 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1095 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1096 long a_ref = (long)a_var.inner & ~1;
1099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1100 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1101 LDKChannelUpdate b_var = tuple->b;
1102 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1103 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1104 long b_ref = (long)b_var.inner & ~1;
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
1108 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1109 LDKChannelUpdate c_var = tuple->c;
1110 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 long c_ref = (long)c_var.inner & ~1;
1115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1116 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1117 ret->datalen = (*env)->GetArrayLength(env, elems);
1118 if (ret->datalen == 0) {
1121 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1122 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1123 for (size_t i = 0; i < ret->datalen; i++) {
1124 int64_t arr_elem = java_elems[i];
1125 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1126 FREE((void*)arr_elem);
1127 ret->data[i] = arr_elem_conv;
1129 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1133 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
1134 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
1135 for (size_t i = 0; i < ret.datalen; i++) {
1136 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1141 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
1142 ret->datalen = (*env)->GetArrayLength(env, elems);
1143 if (ret->datalen == 0) {
1146 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
1147 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1148 for (size_t i = 0; i < ret->datalen; i++) {
1149 int64_t arr_elem = java_elems[i];
1150 LDKNodeAnnouncement arr_elem_conv;
1151 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1152 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1153 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
1154 ret->data[i] = arr_elem_conv;
1156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1160 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
1161 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
1162 for (size_t i = 0; i < ret.datalen; i++) {
1163 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
1167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1168 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
1170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1171 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1172 CHECK(val->result_ok);
1173 return *val->contents.result;
1175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1176 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1177 CHECK(!val->result_ok);
1178 LDKLightningError err_var = (*val->contents.err);
1179 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 long err_ref = (long)err_var.inner & ~1;
1184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1185 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
1187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1188 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1189 CHECK(val->result_ok);
1190 LDKCVec_u8Z res_var = (*val->contents.result);
1191 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
1192 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
1195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1196 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1197 CHECK(!val->result_ok);
1198 LDKPeerHandleError err_var = (*val->contents.err);
1199 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1200 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1201 long err_ref = (long)err_var.inner & ~1;
1204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1205 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
1207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1208 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1209 CHECK(val->result_ok);
1210 return *val->contents.result;
1212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1213 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1214 CHECK(!val->result_ok);
1215 LDKPeerHandleError err_var = (*val->contents.err);
1216 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 long err_ref = (long)err_var.inner & ~1;
1221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1222 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
1224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1225 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1226 CHECK(val->result_ok);
1227 return *val->contents.result;
1229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1230 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1231 CHECK(!val->result_ok);
1232 LDKPeerHandleError err_var = (*val->contents.err);
1233 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 long err_ref = (long)err_var.inner & ~1;
1238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1239 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1242 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1243 CHECK(val->result_ok);
1244 LDKInitFeatures res_var = (*val->contents.result);
1245 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1246 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1247 long res_ref = (long)res_var.inner & ~1;
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1251 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1252 CHECK(!val->result_ok);
1253 LDKDecodeError err_var = (*val->contents.err);
1254 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1255 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1256 long err_ref = (long)err_var.inner & ~1;
1259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1260 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1263 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1264 CHECK(val->result_ok);
1265 LDKNodeFeatures res_var = (*val->contents.result);
1266 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1268 long res_ref = (long)res_var.inner & ~1;
1271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1272 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1273 CHECK(!val->result_ok);
1274 LDKDecodeError err_var = (*val->contents.err);
1275 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1276 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1277 long err_ref = (long)err_var.inner & ~1;
1280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1281 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1284 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1285 CHECK(val->result_ok);
1286 LDKChannelFeatures res_var = (*val->contents.result);
1287 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1288 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1289 long res_ref = (long)res_var.inner & ~1;
1292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1293 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1294 CHECK(!val->result_ok);
1295 LDKDecodeError err_var = (*val->contents.err);
1296 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1297 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1298 long err_ref = (long)err_var.inner & ~1;
1301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1302 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
1304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1305 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1306 CHECK(val->result_ok);
1307 LDKChannelConfig res_var = (*val->contents.result);
1308 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1309 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1310 long res_ref = (long)res_var.inner & ~1;
1313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1314 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1315 CHECK(!val->result_ok);
1316 LDKDecodeError err_var = (*val->contents.err);
1317 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1318 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1319 long err_ref = (long)err_var.inner & ~1;
1322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1323 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1326 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1327 CHECK(val->result_ok);
1328 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1329 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 long res_ref = (long)res_var.inner & ~1;
1334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1335 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1336 CHECK(!val->result_ok);
1337 LDKDecodeError err_var = (*val->contents.err);
1338 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1339 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1340 long err_ref = (long)err_var.inner & ~1;
1343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1344 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1347 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1348 CHECK(val->result_ok);
1349 LDKChannelInfo res_var = (*val->contents.result);
1350 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1352 long res_ref = (long)res_var.inner & ~1;
1355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1356 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1357 CHECK(!val->result_ok);
1358 LDKDecodeError err_var = (*val->contents.err);
1359 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1360 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1361 long err_ref = (long)err_var.inner & ~1;
1364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1365 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1368 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1369 CHECK(val->result_ok);
1370 LDKRoutingFees res_var = (*val->contents.result);
1371 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1372 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1373 long res_ref = (long)res_var.inner & ~1;
1376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1377 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1378 CHECK(!val->result_ok);
1379 LDKDecodeError err_var = (*val->contents.err);
1380 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1381 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1382 long err_ref = (long)err_var.inner & ~1;
1385 static jclass LDKNetAddress_IPv4_class = NULL;
1386 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1387 static jclass LDKNetAddress_IPv6_class = NULL;
1388 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1389 static jclass LDKNetAddress_OnionV2_class = NULL;
1390 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1391 static jclass LDKNetAddress_OnionV3_class = NULL;
1392 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
1393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
1394 LDKNetAddress_IPv4_class =
1395 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
1396 CHECK(LDKNetAddress_IPv4_class != NULL);
1397 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
1398 CHECK(LDKNetAddress_IPv4_meth != NULL);
1399 LDKNetAddress_IPv6_class =
1400 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
1401 CHECK(LDKNetAddress_IPv6_class != NULL);
1402 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
1403 CHECK(LDKNetAddress_IPv6_meth != NULL);
1404 LDKNetAddress_OnionV2_class =
1405 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
1406 CHECK(LDKNetAddress_OnionV2_class != NULL);
1407 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
1408 CHECK(LDKNetAddress_OnionV2_meth != NULL);
1409 LDKNetAddress_OnionV3_class =
1410 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
1411 CHECK(LDKNetAddress_OnionV3_class != NULL);
1412 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
1413 CHECK(LDKNetAddress_OnionV3_meth != NULL);
1415 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1416 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1418 case LDKNetAddress_IPv4: {
1419 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
1420 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
1421 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
1423 case LDKNetAddress_IPv6: {
1424 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
1425 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
1426 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
1428 case LDKNetAddress_OnionV2: {
1429 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
1430 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
1431 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
1433 case LDKNetAddress_OnionV3: {
1434 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
1435 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
1436 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);
1441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1442 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1443 ret->datalen = (*env)->GetArrayLength(env, elems);
1444 if (ret->datalen == 0) {
1447 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1448 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1449 for (size_t i = 0; i < ret->datalen; i++) {
1450 int64_t arr_elem = java_elems[i];
1451 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1452 FREE((void*)arr_elem);
1453 ret->data[i] = arr_elem_conv;
1455 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1459 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1460 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1461 for (size_t i = 0; i < ret.datalen; i++) {
1462 ret.data[i] = NetAddress_clone(&orig->data[i]);
1466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1467 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1470 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1471 CHECK(val->result_ok);
1472 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1473 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1474 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1475 long res_ref = (long)res_var.inner & ~1;
1478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1479 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1480 CHECK(!val->result_ok);
1481 LDKDecodeError err_var = (*val->contents.err);
1482 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1483 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1484 long err_ref = (long)err_var.inner & ~1;
1487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1488 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1489 ret->datalen = (*env)->GetArrayLength(env, elems);
1490 if (ret->datalen == 0) {
1493 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1494 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1495 for (size_t i = 0; i < ret->datalen; i++) {
1496 ret->data[i] = java_elems[i];
1498 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1502 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1503 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1504 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1508 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1511 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1512 CHECK(val->result_ok);
1513 LDKNodeInfo res_var = (*val->contents.result);
1514 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1515 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1516 long res_ref = (long)res_var.inner & ~1;
1519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1520 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1521 CHECK(!val->result_ok);
1522 LDKDecodeError err_var = (*val->contents.err);
1523 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1524 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1525 long err_ref = (long)err_var.inner & ~1;
1528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1529 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1532 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1533 CHECK(val->result_ok);
1534 LDKNetworkGraph res_var = (*val->contents.result);
1535 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1536 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1537 long res_ref = (long)res_var.inner & ~1;
1540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1541 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1542 CHECK(!val->result_ok);
1543 LDKDecodeError err_var = (*val->contents.err);
1544 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1545 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1546 long err_ref = (long)err_var.inner & ~1;
1549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1550 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1552 LDKTransaction b_ref;
1553 b_ref.datalen = (*env)->GetArrayLength(env, b);
1554 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1555 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1556 b_ref.data_is_owned = false;
1560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1561 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1565 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1566 LDKTransaction b_var = tuple->b;
1567 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1568 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1572 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1573 ret->datalen = (*env)->GetArrayLength(env, elems);
1574 if (ret->datalen == 0) {
1577 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1578 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1579 for (size_t i = 0; i < ret->datalen; i++) {
1580 int64_t arr_elem = java_elems[i];
1581 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1582 FREE((void*)arr_elem);
1583 ret->data[i] = arr_elem_conv;
1585 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1590 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1593 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1594 CHECK(val->result_ok);
1595 return *val->contents.result;
1597 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1598 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1599 CHECK(!val->result_ok);
1600 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1603 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1604 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1605 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1606 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1608 LDKMonitorEvent_HTLCEvent_class =
1609 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1610 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1611 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "()V");
1612 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1613 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1615 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1616 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "()V");
1617 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1619 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1620 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1622 case LDKMonitorEvent_HTLCEvent: {
1623 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth);
1625 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1626 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth);
1631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1632 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1633 ret->datalen = (*env)->GetArrayLength(env, elems);
1634 if (ret->datalen == 0) {
1637 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1638 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1639 for (size_t i = 0; i < ret->datalen; i++) {
1640 int64_t arr_elem = java_elems[i];
1641 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1642 FREE((void*)arr_elem);
1643 ret->data[i] = arr_elem_conv;
1645 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1649 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1650 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1651 for (size_t i = 0; i < ret.datalen; i++) {
1652 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1656 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1657 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1658 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1659 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1660 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1661 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1663 LDKSpendableOutputDescriptor_StaticOutput_class =
1664 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1665 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1666 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1667 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1668 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1669 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1670 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1671 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "()V");
1672 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1673 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1674 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1675 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1676 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "()V");
1677 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1679 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1680 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1682 case LDKSpendableOutputDescriptor_StaticOutput: {
1683 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1684 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1685 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1686 long outpoint_ref = (long)outpoint_var.inner & ~1;
1687 long output_ref = ((long)&obj->static_output.output) | 1;
1688 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
1690 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1691 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth);
1693 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1694 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth);
1699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1700 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1701 ret->datalen = (*env)->GetArrayLength(env, elems);
1702 if (ret->datalen == 0) {
1705 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1706 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1707 for (size_t i = 0; i < ret->datalen; i++) {
1708 int64_t arr_elem = java_elems[i];
1709 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1710 FREE((void*)arr_elem);
1711 ret->data[i] = arr_elem_conv;
1713 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1717 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1718 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1719 for (size_t i = 0; i < ret.datalen; i++) {
1720 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1724 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1725 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1726 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1727 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1728 static jclass LDKEvent_PaymentReceived_class = NULL;
1729 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1730 static jclass LDKEvent_PaymentSent_class = NULL;
1731 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1732 static jclass LDKEvent_PaymentFailed_class = NULL;
1733 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1734 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1735 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1736 static jclass LDKEvent_SpendableOutputs_class = NULL;
1737 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1739 LDKEvent_FundingGenerationReady_class =
1740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1741 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1742 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1743 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1744 LDKEvent_FundingBroadcastSafe_class =
1745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1746 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1747 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1748 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1749 LDKEvent_PaymentReceived_class =
1750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1751 CHECK(LDKEvent_PaymentReceived_class != NULL);
1752 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1753 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1754 LDKEvent_PaymentSent_class =
1755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1756 CHECK(LDKEvent_PaymentSent_class != NULL);
1757 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1758 CHECK(LDKEvent_PaymentSent_meth != NULL);
1759 LDKEvent_PaymentFailed_class =
1760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1761 CHECK(LDKEvent_PaymentFailed_class != NULL);
1762 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1763 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1764 LDKEvent_PendingHTLCsForwardable_class =
1765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1766 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1767 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1768 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1769 LDKEvent_SpendableOutputs_class =
1770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1771 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1772 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1773 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1775 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1776 LDKEvent *obj = (LDKEvent*)ptr;
1778 case LDKEvent_FundingGenerationReady: {
1779 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1780 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1781 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1782 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1783 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1784 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);
1786 case LDKEvent_FundingBroadcastSafe: {
1787 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1788 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1789 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1790 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1791 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1793 case LDKEvent_PaymentReceived: {
1794 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1795 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1796 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1797 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1798 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1800 case LDKEvent_PaymentSent: {
1801 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1802 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1803 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1805 case LDKEvent_PaymentFailed: {
1806 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1807 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1808 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1810 case LDKEvent_PendingHTLCsForwardable: {
1811 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1813 case LDKEvent_SpendableOutputs: {
1814 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1815 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1816 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1817 for (size_t b = 0; b < outputs_var.datalen; b++) {
1818 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1819 outputs_arr_ptr[b] = outputs_conv_27_ref;
1821 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1822 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1828 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1829 ret->datalen = (*env)->GetArrayLength(env, elems);
1830 if (ret->datalen == 0) {
1833 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1834 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1835 for (size_t i = 0; i < ret->datalen; i++) {
1836 int64_t arr_elem = java_elems[i];
1837 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1838 FREE((void*)arr_elem);
1839 ret->data[i] = arr_elem_conv;
1841 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1845 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1846 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1847 for (size_t i = 0; i < ret.datalen; i++) {
1848 ret.data[i] = Event_clone(&orig->data[i]);
1852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1853 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1856 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1857 CHECK(val->result_ok);
1858 LDKOutPoint res_var = (*val->contents.result);
1859 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1860 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1861 long res_ref = (long)res_var.inner & ~1;
1864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1865 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1866 CHECK(!val->result_ok);
1867 LDKDecodeError err_var = (*val->contents.err);
1868 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1869 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1870 long err_ref = (long)err_var.inner & ~1;
1873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1874 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1877 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1878 CHECK(val->result_ok);
1879 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1880 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1881 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1882 long res_ref = (long)res_var.inner & ~1;
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1886 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1887 CHECK(!val->result_ok);
1888 LDKDecodeError err_var = (*val->contents.err);
1889 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 long err_ref = (long)err_var.inner & ~1;
1894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1895 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1898 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1899 CHECK(val->result_ok);
1900 LDKHTLCUpdate res_var = (*val->contents.result);
1901 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1902 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1903 long res_ref = (long)res_var.inner & ~1;
1906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1907 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1908 CHECK(!val->result_ok);
1909 LDKDecodeError err_var = (*val->contents.err);
1910 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 long err_ref = (long)err_var.inner & ~1;
1915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1916 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1919 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1920 CHECK(val->result_ok);
1921 return *val->contents.result;
1923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1924 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1925 CHECK(!val->result_ok);
1926 LDKMonitorUpdateError err_var = (*val->contents.err);
1927 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1928 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1929 long err_ref = (long)err_var.inner & ~1;
1932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1933 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1935 a_conv.inner = (void*)(a & (~1));
1936 a_conv.is_owned = (a & 1) || (a == 0);
1937 a_conv = OutPoint_clone(&a_conv);
1940 b_ref.datalen = (*env)->GetArrayLength(env, b);
1941 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1942 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1947 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1948 LDKOutPoint a_var = tuple->a;
1949 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1950 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1951 long a_ref = (long)a_var.inner & ~1;
1954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1955 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1956 LDKCVec_u8Z b_var = tuple->b;
1957 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1958 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
1962 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1964 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1969 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1970 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1974 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1975 long b_ref = ((long)&tuple->b) | 1;
1978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1979 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1980 ret->datalen = (*env)->GetArrayLength(env, elems);
1981 if (ret->datalen == 0) {
1984 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1985 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1986 for (size_t i = 0; i < ret->datalen; i++) {
1987 int64_t arr_elem = java_elems[i];
1988 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1989 FREE((void*)arr_elem);
1990 ret->data[i] = arr_elem_conv;
1992 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1996 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1997 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1998 for (size_t i = 0; i < ret.datalen; i++) {
1999 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
2003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2004 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
2005 LDKThirtyTwoBytes a_ref;
2006 CHECK((*env)->GetArrayLength(env, a) == 32);
2007 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2009 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
2010 b_constr.datalen = (*env)->GetArrayLength(env, b);
2011 if (b_constr.datalen > 0)
2012 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
2014 b_constr.data = NULL;
2015 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2016 for (size_t a = 0; a < b_constr.datalen; a++) {
2017 int64_t b_conv_26 = b_vals[a];
2018 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
2019 FREE((void*)b_conv_26);
2020 b_constr.data[a] = b_conv_26_conv;
2022 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2027 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2028 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2029 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2032 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2033 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2034 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
2035 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2036 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2037 for (size_t a = 0; a < b_var.datalen; a++) {
2038 long b_conv_26_ref = (long)(&b_var.data[a]) | 1;
2039 b_arr_ptr[a] = b_conv_26_ref;
2041 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2045 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
2046 ret->datalen = (*env)->GetArrayLength(env, elems);
2047 if (ret->datalen == 0) {
2050 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
2051 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2052 for (size_t i = 0; i < ret->datalen; i++) {
2053 int64_t arr_elem = java_elems[i];
2054 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
2055 FREE((void*)arr_elem);
2056 ret->data[i] = arr_elem_conv;
2058 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2063 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2065 CHECK((*env)->GetArrayLength(env, a) == 64);
2066 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2068 LDKCVec_SignatureZ b_constr;
2069 b_constr.datalen = (*env)->GetArrayLength(env, b);
2070 if (b_constr.datalen > 0)
2071 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2073 b_constr.data = NULL;
2074 for (size_t i = 0; i < b_constr.datalen; i++) {
2075 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2076 LDKSignature b_conv_8_ref;
2077 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2078 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2079 b_constr.data[i] = b_conv_8_ref;
2084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2085 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2086 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2087 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2090 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2091 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2092 LDKCVec_SignatureZ b_var = tuple->b;
2093 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2095 for (size_t i = 0; i < b_var.datalen; i++) {
2096 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2097 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2098 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2103 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2106 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2107 CHECK(val->result_ok);
2108 long res_ref = (long)(&(*val->contents.result)) | 1;
2111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2112 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2113 CHECK(!val->result_ok);
2114 return *val->contents.err;
2116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2117 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2120 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2121 CHECK(val->result_ok);
2122 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2123 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2127 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2128 CHECK(!val->result_ok);
2129 return *val->contents.err;
2131 typedef struct LDKSign_JCalls {
2132 atomic_size_t refcnt;
2135 jmethodID get_per_commitment_point_meth;
2136 jmethodID release_commitment_secret_meth;
2137 jmethodID channel_keys_id_meth;
2138 jmethodID sign_counterparty_commitment_meth;
2139 jmethodID sign_holder_commitment_and_htlcs_meth;
2140 jmethodID sign_justice_transaction_meth;
2141 jmethodID sign_counterparty_htlc_transaction_meth;
2142 jmethodID sign_closing_transaction_meth;
2143 jmethodID sign_channel_announcement_meth;
2144 jmethodID ready_channel_meth;
2145 jmethodID write_meth;
2147 static void LDKSign_JCalls_free(void* this_arg) {
2148 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2149 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2151 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2152 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2156 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
2157 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2159 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2162 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2163 LDKPublicKey ret_ref;
2164 CHECK((*env)->GetArrayLength(env, ret) == 33);
2165 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2168 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
2169 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2171 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2172 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2174 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2175 LDKThirtyTwoBytes ret_ref;
2176 CHECK((*env)->GetArrayLength(env, ret) == 32);
2177 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2180 LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) {
2181 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2183 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2184 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2186 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2187 LDKThirtyTwoBytes ret_ref;
2188 CHECK((*env)->GetArrayLength(env, ret) == 32);
2189 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2192 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2193 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2195 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2196 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2197 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2198 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2199 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2200 long commitment_tx_ref = (long)commitment_tx_var.inner;
2201 if (commitment_tx_var.is_owned) {
2202 commitment_tx_ref |= 1;
2204 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2206 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2207 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2208 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2211 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2212 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2214 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2215 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2216 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2217 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2218 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2219 long commitment_tx_ref = (long)commitment_tx_var.inner;
2220 if (commitment_tx_var.is_owned) {
2221 commitment_tx_ref |= 1;
2223 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2225 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2226 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2227 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2230 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) {
2231 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2233 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2234 LDKTransaction justice_tx_var = justice_tx;
2235 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2236 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2237 Transaction_free(justice_tx_var);
2238 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2239 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2240 LDKHTLCOutputInCommitment htlc_var = *htlc;
2241 htlc_var = HTLCOutputInCommitment_clone(htlc);
2242 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2243 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2244 long htlc_ref = (long)htlc_var.inner;
2245 if (htlc_var.is_owned) {
2248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2250 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);
2251 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2252 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2255 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) {
2256 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2258 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2259 LDKTransaction htlc_tx_var = htlc_tx;
2260 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2261 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2262 Transaction_free(htlc_tx_var);
2263 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2264 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2265 LDKHTLCOutputInCommitment htlc_var = *htlc;
2266 htlc_var = HTLCOutputInCommitment_clone(htlc);
2267 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2268 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2269 long htlc_ref = (long)htlc_var.inner;
2270 if (htlc_var.is_owned) {
2273 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2275 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);
2276 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2277 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2280 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2281 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2283 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2284 LDKTransaction closing_tx_var = closing_tx;
2285 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2286 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2287 Transaction_free(closing_tx_var);
2288 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2290 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2291 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2292 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2295 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2296 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2299 LDKUnsignedChannelAnnouncement msg_var = *msg;
2300 msg_var = UnsignedChannelAnnouncement_clone(msg);
2301 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2302 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2303 long msg_ref = (long)msg_var.inner;
2304 if (msg_var.is_owned) {
2307 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2309 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2310 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2311 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2314 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2315 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2317 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2318 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2319 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2320 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2321 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2322 long channel_parameters_ref = (long)channel_parameters_var.inner;
2323 if (channel_parameters_var.is_owned) {
2324 channel_parameters_ref |= 1;
2326 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2328 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2330 LDKCVec_u8Z write_jcall(const void* this_arg) {
2331 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2333 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2334 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2336 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2337 LDKCVec_u8Z ret_ref;
2338 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2339 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2340 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2343 static void* LDKSign_JCalls_clone(const void* this_arg) {
2344 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2345 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2346 return (void*) this_arg;
2348 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2349 jclass c = (*env)->GetObjectClass(env, o);
2351 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2352 atomic_init(&calls->refcnt, 1);
2353 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2354 calls->o = (*env)->NewWeakGlobalRef(env, o);
2355 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2356 CHECK(calls->get_per_commitment_point_meth != NULL);
2357 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2358 CHECK(calls->release_commitment_secret_meth != NULL);
2359 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2360 CHECK(calls->channel_keys_id_meth != NULL);
2361 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2362 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2363 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2364 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2365 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2366 CHECK(calls->sign_justice_transaction_meth != NULL);
2367 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2368 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2369 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2370 CHECK(calls->sign_closing_transaction_meth != NULL);
2371 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2372 CHECK(calls->sign_channel_announcement_meth != NULL);
2373 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2374 CHECK(calls->ready_channel_meth != NULL);
2375 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2376 CHECK(calls->write_meth != NULL);
2378 LDKChannelPublicKeys pubkeys_conv;
2379 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2380 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2381 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2384 .this_arg = (void*) calls,
2385 .get_per_commitment_point = get_per_commitment_point_jcall,
2386 .release_commitment_secret = release_commitment_secret_jcall,
2387 .channel_keys_id = channel_keys_id_jcall,
2388 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2389 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
2390 .sign_justice_transaction = sign_justice_transaction_jcall,
2391 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2392 .sign_closing_transaction = sign_closing_transaction_jcall,
2393 .sign_channel_announcement = sign_channel_announcement_jcall,
2394 .ready_channel = ready_channel_jcall,
2395 .clone = LDKSign_JCalls_clone,
2396 .write = write_jcall,
2397 .free = LDKSign_JCalls_free,
2398 .pubkeys = pubkeys_conv,
2399 .set_pubkeys = NULL,
2403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2404 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2405 *res_ptr = LDKSign_init(env, clz, o, pubkeys);
2406 return (long)res_ptr;
2408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2409 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2410 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2411 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2416 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2417 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2418 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2423 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2424 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2425 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2430 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2431 LDKCommitmentTransaction commitment_tx_conv;
2432 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2433 commitment_tx_conv.is_owned = false;
2434 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2435 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2436 return (long)ret_conv;
2439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2440 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2441 LDKHolderCommitmentTransaction commitment_tx_conv;
2442 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2443 commitment_tx_conv.is_owned = false;
2444 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2445 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2446 return (long)ret_conv;
2449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_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) {
2450 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2451 LDKTransaction justice_tx_ref;
2452 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2453 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2454 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2455 justice_tx_ref.data_is_owned = true;
2456 unsigned char per_commitment_key_arr[32];
2457 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2458 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2459 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2460 LDKHTLCOutputInCommitment htlc_conv;
2461 htlc_conv.inner = (void*)(htlc & (~1));
2462 htlc_conv.is_owned = false;
2463 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2464 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2465 return (long)ret_conv;
2468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_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) {
2469 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2470 LDKTransaction htlc_tx_ref;
2471 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2472 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2473 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2474 htlc_tx_ref.data_is_owned = true;
2475 LDKPublicKey per_commitment_point_ref;
2476 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2477 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2478 LDKHTLCOutputInCommitment htlc_conv;
2479 htlc_conv.inner = (void*)(htlc & (~1));
2480 htlc_conv.is_owned = false;
2481 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2482 *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);
2483 return (long)ret_conv;
2486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2487 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2488 LDKTransaction closing_tx_ref;
2489 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2490 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2491 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2492 closing_tx_ref.data_is_owned = true;
2493 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2494 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2495 return (long)ret_conv;
2498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2499 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2500 LDKUnsignedChannelAnnouncement msg_conv;
2501 msg_conv.inner = (void*)(msg & (~1));
2502 msg_conv.is_owned = false;
2503 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2504 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2505 return (long)ret_conv;
2508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2509 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2510 LDKChannelTransactionParameters channel_parameters_conv;
2511 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2512 channel_parameters_conv.is_owned = false;
2513 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2517 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2518 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2521 CVec_u8Z_free(ret_var);
2525 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2526 if (this_arg->set_pubkeys != NULL)
2527 this_arg->set_pubkeys(this_arg);
2528 return this_arg->pubkeys;
2530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2531 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2532 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2533 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2534 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2535 long ret_ref = (long)ret_var.inner;
2536 if (ret_var.is_owned) {
2542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2543 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2544 LDKThirtyTwoBytes a_ref;
2545 CHECK((*env)->GetArrayLength(env, a) == 32);
2546 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2548 LDKChannelMonitor b_conv;
2549 b_conv.inner = (void*)(b & (~1));
2550 b_conv.is_owned = (b & 1) || (b == 0);
2551 b_conv = ChannelMonitor_clone(&b_conv);
2555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2556 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2557 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2558 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2562 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2563 LDKChannelMonitor b_var = tuple->b;
2564 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2565 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2566 long b_ref = (long)b_var.inner & ~1;
2569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2570 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2573 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2574 CHECK(val->result_ok);
2575 long res_ref = (long)(&(*val->contents.result)) | 1;
2578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2579 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2580 CHECK(!val->result_ok);
2581 LDKDecodeError err_var = (*val->contents.err);
2582 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2583 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2584 long err_ref = (long)err_var.inner & ~1;
2587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2588 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2591 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2592 CHECK(val->result_ok);
2593 long res_ref = ((long)&(*val->contents.result)) | 1;
2594 return (long)res_ref;
2596 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2597 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2598 CHECK(!val->result_ok);
2599 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2602 static jclass LDKAPIError_APIMisuseError_class = NULL;
2603 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2604 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2605 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2606 static jclass LDKAPIError_RouteError_class = NULL;
2607 static jmethodID LDKAPIError_RouteError_meth = NULL;
2608 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2609 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2610 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2611 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2613 LDKAPIError_APIMisuseError_class =
2614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2615 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2616 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2617 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2618 LDKAPIError_FeeRateTooHigh_class =
2619 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2620 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2621 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2622 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2623 LDKAPIError_RouteError_class =
2624 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2625 CHECK(LDKAPIError_RouteError_class != NULL);
2626 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2627 CHECK(LDKAPIError_RouteError_meth != NULL);
2628 LDKAPIError_ChannelUnavailable_class =
2629 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2630 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2631 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2632 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2633 LDKAPIError_MonitorUpdateFailed_class =
2634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2635 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2636 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2637 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2640 LDKAPIError *obj = (LDKAPIError*)ptr;
2642 case LDKAPIError_APIMisuseError: {
2643 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2644 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2645 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2646 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2648 case LDKAPIError_FeeRateTooHigh: {
2649 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2650 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2651 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2652 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2654 case LDKAPIError_RouteError: {
2655 LDKStr err_str = obj->route_error.err;
2656 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2657 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2659 case LDKAPIError_ChannelUnavailable: {
2660 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2661 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2662 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2663 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2665 case LDKAPIError_MonitorUpdateFailed: {
2666 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2672 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2675 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2676 CHECK(val->result_ok);
2677 return *val->contents.result;
2679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2680 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2681 CHECK(!val->result_ok);
2682 long err_ref = ((long)&(*val->contents.err)) | 1;
2685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2686 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2687 ret->datalen = (*env)->GetArrayLength(env, elems);
2688 if (ret->datalen == 0) {
2691 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2692 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2693 for (size_t i = 0; i < ret->datalen; i++) {
2694 int64_t arr_elem = java_elems[i];
2695 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2696 FREE((void*)arr_elem);
2697 ret->data[i] = arr_elem_conv;
2699 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2703 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2704 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2705 for (size_t i = 0; i < ret.datalen; i++) {
2706 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2711 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2712 ret->datalen = (*env)->GetArrayLength(env, elems);
2713 if (ret->datalen == 0) {
2716 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2717 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2718 for (size_t i = 0; i < ret->datalen; i++) {
2719 int64_t arr_elem = java_elems[i];
2720 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2721 FREE((void*)arr_elem);
2722 ret->data[i] = arr_elem_conv;
2724 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2728 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2729 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2730 for (size_t i = 0; i < ret.datalen; i++) {
2731 ret.data[i] = APIError_clone(&orig->data[i]);
2735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2736 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2737 ret->datalen = (*env)->GetArrayLength(env, elems);
2738 if (ret->datalen == 0) {
2741 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2742 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2743 for (size_t i = 0; i < ret->datalen; i++) {
2744 int64_t arr_elem = java_elems[i];
2745 LDKChannelDetails arr_elem_conv;
2746 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2747 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2748 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2749 ret->data[i] = arr_elem_conv;
2751 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2755 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2756 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2757 for (size_t i = 0; i < ret.datalen; i++) {
2758 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2762 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
2763 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
2764 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
2765 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
2766 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
2767 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
2768 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
2769 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
2770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
2771 LDKPaymentSendFailure_ParameterError_class =
2772 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
2773 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
2774 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "()V");
2775 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
2776 LDKPaymentSendFailure_PathParameterError_class =
2777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
2778 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
2779 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "()V");
2780 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
2781 LDKPaymentSendFailure_AllFailedRetrySafe_class =
2782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
2783 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
2784 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "()V");
2785 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
2786 LDKPaymentSendFailure_PartialFailure_class =
2787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
2788 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
2789 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "()V");
2790 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
2792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2793 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2795 case LDKPaymentSendFailure_ParameterError: {
2796 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth);
2798 case LDKPaymentSendFailure_PathParameterError: {
2799 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth);
2801 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2802 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth);
2804 case LDKPaymentSendFailure_PartialFailure: {
2805 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth);
2810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2811 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2814 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2815 CHECK(val->result_ok);
2816 return *val->contents.result;
2818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2819 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2820 CHECK(!val->result_ok);
2821 long err_ref = ((long)&(*val->contents.err)) | 1;
2824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2825 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2826 ret->datalen = (*env)->GetArrayLength(env, elems);
2827 if (ret->datalen == 0) {
2830 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2831 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2832 for (size_t i = 0; i < ret->datalen; i++) {
2833 int64_t arr_elem = java_elems[i];
2834 LDKChannelMonitor arr_elem_conv;
2835 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2836 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2837 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2838 ret->data[i] = arr_elem_conv;
2840 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2844 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2845 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2846 for (size_t i = 0; i < ret.datalen; i++) {
2847 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2851 typedef struct LDKWatch_JCalls {
2852 atomic_size_t refcnt;
2855 jmethodID watch_channel_meth;
2856 jmethodID update_channel_meth;
2857 jmethodID release_pending_monitor_events_meth;
2859 static void LDKWatch_JCalls_free(void* this_arg) {
2860 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2861 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2863 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2864 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2868 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2869 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2871 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2872 LDKOutPoint funding_txo_var = funding_txo;
2873 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2874 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2875 long funding_txo_ref = (long)funding_txo_var.inner;
2876 if (funding_txo_var.is_owned) {
2877 funding_txo_ref |= 1;
2879 LDKChannelMonitor monitor_var = monitor;
2880 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2881 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2882 long monitor_ref = (long)monitor_var.inner;
2883 if (monitor_var.is_owned) {
2886 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2888 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2889 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2890 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2893 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2894 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2896 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2897 LDKOutPoint funding_txo_var = funding_txo;
2898 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2899 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2900 long funding_txo_ref = (long)funding_txo_var.inner;
2901 if (funding_txo_var.is_owned) {
2902 funding_txo_ref |= 1;
2904 LDKChannelMonitorUpdate update_var = update;
2905 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2906 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2907 long update_ref = (long)update_var.inner;
2908 if (update_var.is_owned) {
2911 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2913 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2914 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2915 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2918 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2919 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2921 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2922 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2924 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2925 LDKCVec_MonitorEventZ ret_constr;
2926 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
2927 if (ret_constr.datalen > 0)
2928 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2930 ret_constr.data = NULL;
2931 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
2932 for (size_t o = 0; o < ret_constr.datalen; o++) {
2933 int64_t ret_conv_14 = ret_vals[o];
2934 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2935 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
2936 ret_constr.data[o] = ret_conv_14_conv;
2938 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
2941 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2942 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2943 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2944 return (void*) this_arg;
2946 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2947 jclass c = (*env)->GetObjectClass(env, o);
2949 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2950 atomic_init(&calls->refcnt, 1);
2951 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2952 calls->o = (*env)->NewWeakGlobalRef(env, o);
2953 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2954 CHECK(calls->watch_channel_meth != NULL);
2955 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2956 CHECK(calls->update_channel_meth != NULL);
2957 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2958 CHECK(calls->release_pending_monitor_events_meth != NULL);
2961 .this_arg = (void*) calls,
2962 .watch_channel = watch_channel_jcall,
2963 .update_channel = update_channel_jcall,
2964 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2965 .free = LDKWatch_JCalls_free,
2969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2970 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2971 *res_ptr = LDKWatch_init(env, clz, o);
2972 return (long)res_ptr;
2974 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) {
2975 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2976 LDKOutPoint funding_txo_conv;
2977 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2978 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2979 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2980 LDKChannelMonitor monitor_conv;
2981 monitor_conv.inner = (void*)(monitor & (~1));
2982 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2983 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2984 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2985 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2986 return (long)ret_conv;
2989 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) {
2990 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2991 LDKOutPoint funding_txo_conv;
2992 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2993 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2994 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2995 LDKChannelMonitorUpdate update_conv;
2996 update_conv.inner = (void*)(update & (~1));
2997 update_conv.is_owned = (update & 1) || (update == 0);
2998 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2999 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3000 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3001 return (long)ret_conv;
3004 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3005 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
3006 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3007 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3008 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3009 for (size_t o = 0; o < ret_var.datalen; o++) {
3010 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3011 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3012 long ret_conv_14_ref = (long)ret_conv_14_copy;
3013 ret_arr_ptr[o] = ret_conv_14_ref;
3015 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3020 typedef struct LDKBroadcasterInterface_JCalls {
3021 atomic_size_t refcnt;
3024 jmethodID broadcast_transaction_meth;
3025 } LDKBroadcasterInterface_JCalls;
3026 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3027 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3028 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3030 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3031 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3035 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
3036 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3039 LDKTransaction tx_var = tx;
3040 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3041 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3042 Transaction_free(tx_var);
3043 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3045 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3047 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3048 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3049 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3050 return (void*) this_arg;
3052 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3053 jclass c = (*env)->GetObjectClass(env, o);
3055 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3056 atomic_init(&calls->refcnt, 1);
3057 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3058 calls->o = (*env)->NewWeakGlobalRef(env, o);
3059 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3060 CHECK(calls->broadcast_transaction_meth != NULL);
3062 LDKBroadcasterInterface ret = {
3063 .this_arg = (void*) calls,
3064 .broadcast_transaction = broadcast_transaction_jcall,
3065 .free = LDKBroadcasterInterface_JCalls_free,
3069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3070 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3071 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3072 return (long)res_ptr;
3074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3075 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
3076 LDKTransaction tx_ref;
3077 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3078 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3079 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3080 tx_ref.data_is_owned = true;
3081 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3085 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3088 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3089 CHECK(val->result_ok);
3090 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3091 *ret = Sign_clone(&(*val->contents.result));
3094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3095 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3096 CHECK(!val->result_ok);
3097 LDKDecodeError err_var = (*val->contents.err);
3098 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3099 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3100 long err_ref = (long)err_var.inner & ~1;
3103 typedef struct LDKKeysInterface_JCalls {
3104 atomic_size_t refcnt;
3107 jmethodID get_node_secret_meth;
3108 jmethodID get_destination_script_meth;
3109 jmethodID get_shutdown_pubkey_meth;
3110 jmethodID get_channel_signer_meth;
3111 jmethodID get_secure_random_bytes_meth;
3112 jmethodID read_chan_signer_meth;
3113 } LDKKeysInterface_JCalls;
3114 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3115 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3118 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3119 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3123 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
3124 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3126 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3127 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3129 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3130 LDKSecretKey ret_ref;
3131 CHECK((*env)->GetArrayLength(env, ret) == 32);
3132 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3135 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
3136 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3138 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3139 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3141 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3142 LDKCVec_u8Z ret_ref;
3143 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3144 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3145 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3148 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
3149 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3151 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3152 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3154 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3155 LDKPublicKey ret_ref;
3156 CHECK((*env)->GetArrayLength(env, ret) == 33);
3157 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3160 LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3161 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3163 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3164 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3166 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3167 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3168 ret_conv = Sign_clone(ret);
3171 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
3172 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3174 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3175 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3177 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3178 LDKThirtyTwoBytes ret_ref;
3179 CHECK((*env)->GetArrayLength(env, ret) == 32);
3180 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3183 LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
3184 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3186 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3187 LDKu8slice reader_var = reader;
3188 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3189 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3190 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3192 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3193 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3194 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
3197 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3198 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3199 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3200 return (void*) this_arg;
3202 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3203 jclass c = (*env)->GetObjectClass(env, o);
3205 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3206 atomic_init(&calls->refcnt, 1);
3207 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3208 calls->o = (*env)->NewWeakGlobalRef(env, o);
3209 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3210 CHECK(calls->get_node_secret_meth != NULL);
3211 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3212 CHECK(calls->get_destination_script_meth != NULL);
3213 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3214 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3215 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3216 CHECK(calls->get_channel_signer_meth != NULL);
3217 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3218 CHECK(calls->get_secure_random_bytes_meth != NULL);
3219 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3220 CHECK(calls->read_chan_signer_meth != NULL);
3222 LDKKeysInterface ret = {
3223 .this_arg = (void*) calls,
3224 .get_node_secret = get_node_secret_jcall,
3225 .get_destination_script = get_destination_script_jcall,
3226 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
3227 .get_channel_signer = get_channel_signer_jcall,
3228 .get_secure_random_bytes = get_secure_random_bytes_jcall,
3229 .read_chan_signer = read_chan_signer_jcall,
3230 .free = LDKKeysInterface_JCalls_free,
3234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3235 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3236 *res_ptr = LDKKeysInterface_init(env, clz, o);
3237 return (long)res_ptr;
3239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3240 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3241 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3247 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3248 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3249 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3250 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3251 CVec_u8Z_free(ret_var);
3255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3256 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3257 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3263 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3264 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3265 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3270 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3271 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3272 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3277 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3278 LDKu8slice reader_ref;
3279 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3280 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3281 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3282 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3283 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3284 return (long)ret_conv;
3287 typedef struct LDKFeeEstimator_JCalls {
3288 atomic_size_t refcnt;
3291 jmethodID get_est_sat_per_1000_weight_meth;
3292 } LDKFeeEstimator_JCalls;
3293 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3294 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3295 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3297 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3298 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3302 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3303 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3305 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3306 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3307 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3309 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3311 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3312 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3313 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3314 return (void*) this_arg;
3316 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3317 jclass c = (*env)->GetObjectClass(env, o);
3319 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3320 atomic_init(&calls->refcnt, 1);
3321 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3322 calls->o = (*env)->NewWeakGlobalRef(env, o);
3323 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
3324 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3326 LDKFeeEstimator ret = {
3327 .this_arg = (void*) calls,
3328 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
3329 .free = LDKFeeEstimator_JCalls_free,
3333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3334 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3335 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3336 return (long)res_ptr;
3338 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) {
3339 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
3340 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3341 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3345 typedef struct LDKLogger_JCalls {
3346 atomic_size_t refcnt;
3351 static void LDKLogger_JCalls_free(void* this_arg) {
3352 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3353 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3355 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3356 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3360 void log_jcall(const void* this_arg, const char* record) {
3361 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3364 const char* record_str = record;
3365 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3366 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3368 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3370 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3371 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3372 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3373 return (void*) this_arg;
3375 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3376 jclass c = (*env)->GetObjectClass(env, o);
3378 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3379 atomic_init(&calls->refcnt, 1);
3380 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3381 calls->o = (*env)->NewWeakGlobalRef(env, o);
3382 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3383 CHECK(calls->log_meth != NULL);
3386 .this_arg = (void*) calls,
3388 .free = LDKLogger_JCalls_free,
3392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3393 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3394 *res_ptr = LDKLogger_init(env, clz, o);
3395 return (long)res_ptr;
3397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3398 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3399 LDKThirtyTwoBytes a_ref;
3400 CHECK((*env)->GetArrayLength(env, a) == 32);
3401 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3403 LDKChannelManager b_conv;
3404 b_conv.inner = (void*)(b & (~1));
3405 b_conv.is_owned = (b & 1) || (b == 0);
3406 // Warning: we need a move here but no clone is available for LDKChannelManager
3410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3411 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3412 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3413 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3417 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3418 LDKChannelManager b_var = tuple->b;
3419 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3420 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3421 long b_ref = (long)b_var.inner & ~1;
3424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3425 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3428 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3429 CHECK(val->result_ok);
3430 long res_ref = (long)(&(*val->contents.result)) | 1;
3433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3434 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3435 CHECK(!val->result_ok);
3436 LDKDecodeError err_var = (*val->contents.err);
3437 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3438 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3439 long err_ref = (long)err_var.inner & ~1;
3442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3443 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3446 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3447 CHECK(val->result_ok);
3448 long res_ref = ((long)&(*val->contents.result)) | 1;
3451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3452 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3453 CHECK(!val->result_ok);
3454 LDKDecodeError err_var = (*val->contents.err);
3455 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3456 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3457 long err_ref = (long)err_var.inner & ~1;
3460 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3461 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3462 for (size_t i = 0; i < ret.datalen; i++) {
3463 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3468 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3470 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3471 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3472 CHECK(val->result_ok);
3473 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3474 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3476 for (size_t i = 0; i < res_var.datalen; i++) {
3477 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3478 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3479 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3480 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3485 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3486 CHECK(!val->result_ok);
3487 return *val->contents.err;
3489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3490 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3493 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3494 CHECK(val->result_ok);
3495 LDKInMemorySigner res_var = (*val->contents.result);
3496 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3497 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3498 long res_ref = (long)res_var.inner & ~1;
3501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3502 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3503 CHECK(!val->result_ok);
3504 LDKDecodeError err_var = (*val->contents.err);
3505 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3506 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3507 long err_ref = (long)err_var.inner & ~1;
3510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3511 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3512 ret->datalen = (*env)->GetArrayLength(env, elems);
3513 if (ret->datalen == 0) {
3516 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3517 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3518 for (size_t i = 0; i < ret->datalen; i++) {
3519 int64_t arr_elem = java_elems[i];
3520 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3521 FREE((void*)arr_elem);
3522 ret->data[i] = arr_elem_conv;
3524 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3528 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3529 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3530 for (size_t i = 0; i < ret.datalen; i++) {
3531 ret.data[i] = TxOut_clone(&orig->data[i]);
3535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3536 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3539 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3540 CHECK(val->result_ok);
3541 LDKTransaction res_var = (*val->contents.result);
3542 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3543 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3547 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3548 CHECK(!val->result_ok);
3549 return *val->contents.err;
3551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3552 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3553 ret->datalen = (*env)->GetArrayLength(env, elems);
3554 if (ret->datalen == 0) {
3557 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3558 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3559 for (size_t i = 0; i < ret->datalen; i++) {
3560 int64_t arr_elem = java_elems[i];
3561 LDKRouteHop arr_elem_conv;
3562 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3563 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3564 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3565 ret->data[i] = arr_elem_conv;
3567 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3571 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3572 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3573 for (size_t i = 0; i < ret.datalen; i++) {
3574 ret.data[i] = RouteHop_clone(&orig->data[i]);
3578 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3579 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3580 for (size_t i = 0; i < ret.datalen; i++) {
3581 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3586 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3589 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3590 CHECK(val->result_ok);
3591 LDKRoute res_var = (*val->contents.result);
3592 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3593 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3594 long res_ref = (long)res_var.inner & ~1;
3597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3598 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3599 CHECK(!val->result_ok);
3600 LDKDecodeError err_var = (*val->contents.err);
3601 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3602 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3603 long err_ref = (long)err_var.inner & ~1;
3606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3607 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3608 ret->datalen = (*env)->GetArrayLength(env, elems);
3609 if (ret->datalen == 0) {
3612 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3613 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3614 for (size_t i = 0; i < ret->datalen; i++) {
3615 int64_t arr_elem = java_elems[i];
3616 LDKRouteHint arr_elem_conv;
3617 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3618 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3619 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3620 ret->data[i] = arr_elem_conv;
3622 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3626 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3627 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3628 for (size_t i = 0; i < ret.datalen; i++) {
3629 ret.data[i] = RouteHint_clone(&orig->data[i]);
3633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3634 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3637 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3638 CHECK(val->result_ok);
3639 LDKRoute res_var = (*val->contents.result);
3640 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3641 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3642 long res_ref = (long)res_var.inner & ~1;
3645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3646 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3647 CHECK(!val->result_ok);
3648 LDKLightningError err_var = (*val->contents.err);
3649 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3650 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3651 long err_ref = (long)err_var.inner & ~1;
3654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3655 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3658 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3659 CHECK(val->result_ok);
3660 long res_ref = ((long)&(*val->contents.result)) | 1;
3663 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3664 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3665 CHECK(!val->result_ok);
3666 return *val->contents.err;
3668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3669 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3672 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3673 CHECK(val->result_ok);
3674 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3675 *res_conv = (*val->contents.result);
3676 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3677 return (long)res_conv;
3679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3680 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3681 CHECK(!val->result_ok);
3682 LDKDecodeError err_var = (*val->contents.err);
3683 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3684 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3685 long err_ref = (long)err_var.inner & ~1;
3688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3689 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3690 ret->datalen = (*env)->GetArrayLength(env, elems);
3691 if (ret->datalen == 0) {
3694 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3695 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3696 for (size_t i = 0; i < ret->datalen; i++) {
3697 int64_t arr_elem = java_elems[i];
3698 LDKUpdateAddHTLC arr_elem_conv;
3699 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3700 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3701 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3702 ret->data[i] = arr_elem_conv;
3704 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3708 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3709 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3710 for (size_t i = 0; i < ret.datalen; i++) {
3711 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3716 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3717 ret->datalen = (*env)->GetArrayLength(env, elems);
3718 if (ret->datalen == 0) {
3721 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3722 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3723 for (size_t i = 0; i < ret->datalen; i++) {
3724 int64_t arr_elem = java_elems[i];
3725 LDKUpdateFulfillHTLC arr_elem_conv;
3726 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3727 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3728 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3729 ret->data[i] = arr_elem_conv;
3731 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3735 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3736 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3737 for (size_t i = 0; i < ret.datalen; i++) {
3738 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3743 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3744 ret->datalen = (*env)->GetArrayLength(env, elems);
3745 if (ret->datalen == 0) {
3748 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3749 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3750 for (size_t i = 0; i < ret->datalen; i++) {
3751 int64_t arr_elem = java_elems[i];
3752 LDKUpdateFailHTLC arr_elem_conv;
3753 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3754 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3755 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3756 ret->data[i] = arr_elem_conv;
3758 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3762 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3763 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3764 for (size_t i = 0; i < ret.datalen; i++) {
3765 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3770 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3771 ret->datalen = (*env)->GetArrayLength(env, elems);
3772 if (ret->datalen == 0) {
3775 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3776 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3777 for (size_t i = 0; i < ret->datalen; i++) {
3778 int64_t arr_elem = java_elems[i];
3779 LDKUpdateFailMalformedHTLC arr_elem_conv;
3780 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3781 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3782 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3783 ret->data[i] = arr_elem_conv;
3785 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3789 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3790 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3791 for (size_t i = 0; i < ret.datalen; i++) {
3792 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3797 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3800 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3801 CHECK(val->result_ok);
3802 LDKAcceptChannel res_var = (*val->contents.result);
3803 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3804 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3805 long res_ref = (long)res_var.inner & ~1;
3808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3809 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3810 CHECK(!val->result_ok);
3811 LDKDecodeError err_var = (*val->contents.err);
3812 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3813 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3814 long err_ref = (long)err_var.inner & ~1;
3817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3818 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3821 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3822 CHECK(val->result_ok);
3823 LDKAnnouncementSignatures res_var = (*val->contents.result);
3824 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3825 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3826 long res_ref = (long)res_var.inner & ~1;
3829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3830 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3831 CHECK(!val->result_ok);
3832 LDKDecodeError err_var = (*val->contents.err);
3833 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3834 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3835 long err_ref = (long)err_var.inner & ~1;
3838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3839 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3842 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3843 CHECK(val->result_ok);
3844 LDKChannelReestablish res_var = (*val->contents.result);
3845 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3846 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3847 long res_ref = (long)res_var.inner & ~1;
3850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3851 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3852 CHECK(!val->result_ok);
3853 LDKDecodeError err_var = (*val->contents.err);
3854 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3855 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3856 long err_ref = (long)err_var.inner & ~1;
3859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3860 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3863 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3864 CHECK(val->result_ok);
3865 LDKClosingSigned res_var = (*val->contents.result);
3866 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3867 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3868 long res_ref = (long)res_var.inner & ~1;
3871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3872 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3873 CHECK(!val->result_ok);
3874 LDKDecodeError err_var = (*val->contents.err);
3875 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3876 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3877 long err_ref = (long)err_var.inner & ~1;
3880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3881 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3884 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3885 CHECK(val->result_ok);
3886 LDKCommitmentSigned res_var = (*val->contents.result);
3887 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3888 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3889 long res_ref = (long)res_var.inner & ~1;
3892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3893 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3894 CHECK(!val->result_ok);
3895 LDKDecodeError err_var = (*val->contents.err);
3896 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3897 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3898 long err_ref = (long)err_var.inner & ~1;
3901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3902 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3905 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3906 CHECK(val->result_ok);
3907 LDKFundingCreated res_var = (*val->contents.result);
3908 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3909 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3910 long res_ref = (long)res_var.inner & ~1;
3913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3914 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3915 CHECK(!val->result_ok);
3916 LDKDecodeError err_var = (*val->contents.err);
3917 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3918 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3919 long err_ref = (long)err_var.inner & ~1;
3922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3923 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3926 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3927 CHECK(val->result_ok);
3928 LDKFundingSigned res_var = (*val->contents.result);
3929 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3930 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3931 long res_ref = (long)res_var.inner & ~1;
3934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3935 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3936 CHECK(!val->result_ok);
3937 LDKDecodeError err_var = (*val->contents.err);
3938 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3939 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3940 long err_ref = (long)err_var.inner & ~1;
3943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3944 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3947 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3948 CHECK(val->result_ok);
3949 LDKFundingLocked res_var = (*val->contents.result);
3950 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3951 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3952 long res_ref = (long)res_var.inner & ~1;
3955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3956 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3957 CHECK(!val->result_ok);
3958 LDKDecodeError err_var = (*val->contents.err);
3959 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3960 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3961 long err_ref = (long)err_var.inner & ~1;
3964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3965 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3968 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3969 CHECK(val->result_ok);
3970 LDKInit res_var = (*val->contents.result);
3971 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3972 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3973 long res_ref = (long)res_var.inner & ~1;
3976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3977 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3978 CHECK(!val->result_ok);
3979 LDKDecodeError err_var = (*val->contents.err);
3980 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3981 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3982 long err_ref = (long)err_var.inner & ~1;
3985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3986 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3989 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3990 CHECK(val->result_ok);
3991 LDKOpenChannel res_var = (*val->contents.result);
3992 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3993 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3994 long res_ref = (long)res_var.inner & ~1;
3997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3998 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3999 CHECK(!val->result_ok);
4000 LDKDecodeError err_var = (*val->contents.err);
4001 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4002 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4003 long err_ref = (long)err_var.inner & ~1;
4006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4007 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4010 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4011 CHECK(val->result_ok);
4012 LDKRevokeAndACK res_var = (*val->contents.result);
4013 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4014 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4015 long res_ref = (long)res_var.inner & ~1;
4018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4019 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4020 CHECK(!val->result_ok);
4021 LDKDecodeError err_var = (*val->contents.err);
4022 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4023 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4024 long err_ref = (long)err_var.inner & ~1;
4027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4028 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4031 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4032 CHECK(val->result_ok);
4033 LDKShutdown res_var = (*val->contents.result);
4034 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4035 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4036 long res_ref = (long)res_var.inner & ~1;
4039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4040 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4041 CHECK(!val->result_ok);
4042 LDKDecodeError err_var = (*val->contents.err);
4043 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 long err_ref = (long)err_var.inner & ~1;
4048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4049 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4052 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4053 CHECK(val->result_ok);
4054 LDKUpdateFailHTLC res_var = (*val->contents.result);
4055 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4056 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4057 long res_ref = (long)res_var.inner & ~1;
4060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4061 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4062 CHECK(!val->result_ok);
4063 LDKDecodeError err_var = (*val->contents.err);
4064 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4065 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4066 long err_ref = (long)err_var.inner & ~1;
4069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4070 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4073 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4074 CHECK(val->result_ok);
4075 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4076 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 long res_ref = (long)res_var.inner & ~1;
4081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4082 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4083 CHECK(!val->result_ok);
4084 LDKDecodeError err_var = (*val->contents.err);
4085 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4086 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4087 long err_ref = (long)err_var.inner & ~1;
4090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4091 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4094 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4095 CHECK(val->result_ok);
4096 LDKUpdateFee res_var = (*val->contents.result);
4097 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4098 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4099 long res_ref = (long)res_var.inner & ~1;
4102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4103 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4104 CHECK(!val->result_ok);
4105 LDKDecodeError err_var = (*val->contents.err);
4106 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4107 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4108 long err_ref = (long)err_var.inner & ~1;
4111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4112 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4115 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4116 CHECK(val->result_ok);
4117 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4118 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 long res_ref = (long)res_var.inner & ~1;
4123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4124 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4125 CHECK(!val->result_ok);
4126 LDKDecodeError err_var = (*val->contents.err);
4127 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4128 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4129 long err_ref = (long)err_var.inner & ~1;
4132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4133 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4136 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4137 CHECK(val->result_ok);
4138 LDKUpdateAddHTLC res_var = (*val->contents.result);
4139 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4140 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4141 long res_ref = (long)res_var.inner & ~1;
4144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4145 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4146 CHECK(!val->result_ok);
4147 LDKDecodeError err_var = (*val->contents.err);
4148 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4149 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4150 long err_ref = (long)err_var.inner & ~1;
4153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4154 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4157 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4158 CHECK(val->result_ok);
4159 LDKPing res_var = (*val->contents.result);
4160 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 long res_ref = (long)res_var.inner & ~1;
4165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4166 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4167 CHECK(!val->result_ok);
4168 LDKDecodeError err_var = (*val->contents.err);
4169 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 long err_ref = (long)err_var.inner & ~1;
4174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4175 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4178 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4179 CHECK(val->result_ok);
4180 LDKPong res_var = (*val->contents.result);
4181 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4182 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4183 long res_ref = (long)res_var.inner & ~1;
4186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4187 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4188 CHECK(!val->result_ok);
4189 LDKDecodeError err_var = (*val->contents.err);
4190 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4191 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4192 long err_ref = (long)err_var.inner & ~1;
4195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4196 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4199 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4200 CHECK(val->result_ok);
4201 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4202 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 long res_ref = (long)res_var.inner & ~1;
4207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4208 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4209 CHECK(!val->result_ok);
4210 LDKDecodeError err_var = (*val->contents.err);
4211 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4212 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4213 long err_ref = (long)err_var.inner & ~1;
4216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4217 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4220 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4221 CHECK(val->result_ok);
4222 LDKChannelAnnouncement res_var = (*val->contents.result);
4223 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4224 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 long res_ref = (long)res_var.inner & ~1;
4228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4229 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4230 CHECK(!val->result_ok);
4231 LDKDecodeError err_var = (*val->contents.err);
4232 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 long err_ref = (long)err_var.inner & ~1;
4237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4238 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4241 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4242 CHECK(val->result_ok);
4243 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4244 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4245 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4246 long res_ref = (long)res_var.inner & ~1;
4249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4250 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4251 CHECK(!val->result_ok);
4252 LDKDecodeError err_var = (*val->contents.err);
4253 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4254 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4255 long err_ref = (long)err_var.inner & ~1;
4258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4259 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4262 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4263 CHECK(val->result_ok);
4264 LDKChannelUpdate res_var = (*val->contents.result);
4265 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4266 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4267 long res_ref = (long)res_var.inner & ~1;
4270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4271 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4272 CHECK(!val->result_ok);
4273 LDKDecodeError err_var = (*val->contents.err);
4274 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4275 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4276 long err_ref = (long)err_var.inner & ~1;
4279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4280 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4283 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4284 CHECK(val->result_ok);
4285 LDKErrorMessage res_var = (*val->contents.result);
4286 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 long res_ref = (long)res_var.inner & ~1;
4291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4292 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4293 CHECK(!val->result_ok);
4294 LDKDecodeError err_var = (*val->contents.err);
4295 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4296 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4297 long err_ref = (long)err_var.inner & ~1;
4300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4301 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4304 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4305 CHECK(val->result_ok);
4306 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4307 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4308 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4309 long res_ref = (long)res_var.inner & ~1;
4312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4313 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4314 CHECK(!val->result_ok);
4315 LDKDecodeError err_var = (*val->contents.err);
4316 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4317 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4318 long err_ref = (long)err_var.inner & ~1;
4321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4322 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4325 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4326 CHECK(val->result_ok);
4327 LDKNodeAnnouncement res_var = (*val->contents.result);
4328 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4329 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4330 long res_ref = (long)res_var.inner & ~1;
4333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4334 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4335 CHECK(!val->result_ok);
4336 LDKDecodeError err_var = (*val->contents.err);
4337 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4338 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4339 long err_ref = (long)err_var.inner & ~1;
4342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4343 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4346 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4347 CHECK(val->result_ok);
4348 LDKQueryShortChannelIds res_var = (*val->contents.result);
4349 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4350 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4351 long res_ref = (long)res_var.inner & ~1;
4354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4355 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4356 CHECK(!val->result_ok);
4357 LDKDecodeError err_var = (*val->contents.err);
4358 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 long err_ref = (long)err_var.inner & ~1;
4363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4364 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4367 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4368 CHECK(val->result_ok);
4369 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4370 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4371 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4372 long res_ref = (long)res_var.inner & ~1;
4375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4376 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4377 CHECK(!val->result_ok);
4378 LDKDecodeError err_var = (*val->contents.err);
4379 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4380 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4381 long err_ref = (long)err_var.inner & ~1;
4384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4385 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4388 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4389 CHECK(val->result_ok);
4390 LDKQueryChannelRange res_var = (*val->contents.result);
4391 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 long res_ref = (long)res_var.inner & ~1;
4396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4397 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4398 CHECK(!val->result_ok);
4399 LDKDecodeError err_var = (*val->contents.err);
4400 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 long err_ref = (long)err_var.inner & ~1;
4405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4406 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4409 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4410 CHECK(val->result_ok);
4411 LDKReplyChannelRange res_var = (*val->contents.result);
4412 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 long res_ref = (long)res_var.inner & ~1;
4417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4418 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4419 CHECK(!val->result_ok);
4420 LDKDecodeError err_var = (*val->contents.err);
4421 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 long err_ref = (long)err_var.inner & ~1;
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4427 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4430 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4431 CHECK(val->result_ok);
4432 LDKGossipTimestampFilter res_var = (*val->contents.result);
4433 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 long res_ref = (long)res_var.inner & ~1;
4438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4439 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4440 CHECK(!val->result_ok);
4441 LDKDecodeError err_var = (*val->contents.err);
4442 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4443 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4444 long err_ref = (long)err_var.inner & ~1;
4447 typedef struct LDKMessageSendEventsProvider_JCalls {
4448 atomic_size_t refcnt;
4451 jmethodID get_and_clear_pending_msg_events_meth;
4452 } LDKMessageSendEventsProvider_JCalls;
4453 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4454 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_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 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
4463 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4466 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4468 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
4469 LDKCVec_MessageSendEventZ ret_constr;
4470 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4471 if (ret_constr.datalen > 0)
4472 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4474 ret_constr.data = NULL;
4475 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4476 for (size_t s = 0; s < ret_constr.datalen; s++) {
4477 int64_t ret_conv_18 = ret_vals[s];
4478 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4479 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
4480 ret_constr.data[s] = ret_conv_18_conv;
4482 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4485 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4486 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4487 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4488 return (void*) this_arg;
4490 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4491 jclass c = (*env)->GetObjectClass(env, o);
4493 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4494 atomic_init(&calls->refcnt, 1);
4495 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4496 calls->o = (*env)->NewWeakGlobalRef(env, o);
4497 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
4498 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
4500 LDKMessageSendEventsProvider ret = {
4501 .this_arg = (void*) calls,
4502 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
4503 .free = LDKMessageSendEventsProvider_JCalls_free,
4507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4508 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4509 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
4510 return (long)res_ptr;
4512 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4513 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
4514 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4515 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4516 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4517 for (size_t s = 0; s < ret_var.datalen; s++) {
4518 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4519 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4520 long ret_conv_18_ref = (long)ret_conv_18_copy;
4521 ret_arr_ptr[s] = ret_conv_18_ref;
4523 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4528 typedef struct LDKEventsProvider_JCalls {
4529 atomic_size_t refcnt;
4532 jmethodID get_and_clear_pending_events_meth;
4533 } LDKEventsProvider_JCalls;
4534 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4535 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4536 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4538 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4539 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4543 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
4544 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4546 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4547 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4549 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
4550 LDKCVec_EventZ ret_constr;
4551 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4552 if (ret_constr.datalen > 0)
4553 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4555 ret_constr.data = NULL;
4556 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4557 for (size_t h = 0; h < ret_constr.datalen; h++) {
4558 int64_t ret_conv_7 = ret_vals[h];
4559 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4560 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
4561 ret_constr.data[h] = ret_conv_7_conv;
4563 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4566 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4567 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4568 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4569 return (void*) this_arg;
4571 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4572 jclass c = (*env)->GetObjectClass(env, o);
4574 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4575 atomic_init(&calls->refcnt, 1);
4576 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4577 calls->o = (*env)->NewWeakGlobalRef(env, o);
4578 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
4579 CHECK(calls->get_and_clear_pending_events_meth != NULL);
4581 LDKEventsProvider ret = {
4582 .this_arg = (void*) calls,
4583 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
4584 .free = LDKEventsProvider_JCalls_free,
4588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4589 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4590 *res_ptr = LDKEventsProvider_init(env, clz, o);
4591 return (long)res_ptr;
4593 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4594 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
4595 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4596 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4597 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4598 for (size_t h = 0; h < ret_var.datalen; h++) {
4599 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4600 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4601 long ret_conv_7_ref = (long)ret_conv_7_copy;
4602 ret_arr_ptr[h] = ret_conv_7_ref;
4604 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4609 typedef struct LDKAccess_JCalls {
4610 atomic_size_t refcnt;
4613 jmethodID get_utxo_meth;
4615 static void LDKAccess_JCalls_free(void* this_arg) {
4616 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4617 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4619 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4620 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4624 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4625 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4628 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4629 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4630 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4632 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4633 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4634 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4637 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4638 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4639 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4640 return (void*) this_arg;
4642 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4643 jclass c = (*env)->GetObjectClass(env, o);
4645 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4646 atomic_init(&calls->refcnt, 1);
4647 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4648 calls->o = (*env)->NewWeakGlobalRef(env, o);
4649 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4650 CHECK(calls->get_utxo_meth != NULL);
4653 .this_arg = (void*) calls,
4654 .get_utxo = get_utxo_jcall,
4655 .free = LDKAccess_JCalls_free,
4659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4660 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4661 *res_ptr = LDKAccess_init(env, clz, o);
4662 return (long)res_ptr;
4664 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) {
4665 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
4666 unsigned char genesis_hash_arr[32];
4667 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4668 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4669 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4670 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4671 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4672 return (long)ret_conv;
4675 typedef struct LDKListen_JCalls {
4676 atomic_size_t refcnt;
4679 jmethodID block_connected_meth;
4680 jmethodID block_disconnected_meth;
4682 static void LDKListen_JCalls_free(void* this_arg) {
4683 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4684 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4686 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4687 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4691 void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4692 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4694 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4695 LDKu8slice block_var = block;
4696 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
4697 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
4698 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4700 return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
4702 void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4703 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4705 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4706 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
4707 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
4708 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4710 return (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
4712 static void* LDKListen_JCalls_clone(const void* this_arg) {
4713 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4714 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4715 return (void*) this_arg;
4717 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
4718 jclass c = (*env)->GetObjectClass(env, o);
4720 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4721 atomic_init(&calls->refcnt, 1);
4722 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4723 calls->o = (*env)->NewWeakGlobalRef(env, o);
4724 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
4725 CHECK(calls->block_connected_meth != NULL);
4726 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
4727 CHECK(calls->block_disconnected_meth != NULL);
4730 .this_arg = (void*) calls,
4731 .block_connected = block_connected_jcall,
4732 .block_disconnected = block_disconnected_jcall,
4733 .free = LDKListen_JCalls_free,
4737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
4738 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4739 *res_ptr = LDKListen_init(env, clz, o);
4740 return (long)res_ptr;
4742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
4743 LDKListen* this_arg_conv = (LDKListen*)this_arg;
4744 LDKu8slice block_ref;
4745 block_ref.datalen = (*env)->GetArrayLength(env, block);
4746 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
4747 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4748 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
4751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
4752 LDKListen* this_arg_conv = (LDKListen*)this_arg;
4753 unsigned char header_arr[80];
4754 CHECK((*env)->GetArrayLength(env, header) == 80);
4755 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
4756 unsigned char (*header_ref)[80] = &header_arr;
4757 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4760 typedef struct LDKFilter_JCalls {
4761 atomic_size_t refcnt;
4764 jmethodID register_tx_meth;
4765 jmethodID register_output_meth;
4767 static void LDKFilter_JCalls_free(void* this_arg) {
4768 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4771 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4772 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4776 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4777 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4779 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4780 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4781 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4782 LDKu8slice script_pubkey_var = script_pubkey;
4783 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4784 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4785 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4787 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4789 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4790 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4792 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4793 LDKOutPoint outpoint_var = *outpoint;
4794 outpoint_var = OutPoint_clone(outpoint);
4795 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4796 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4797 long outpoint_ref = (long)outpoint_var.inner;
4798 if (outpoint_var.is_owned) {
4801 LDKu8slice script_pubkey_var = script_pubkey;
4802 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4803 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4806 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4808 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4809 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4810 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4811 return (void*) this_arg;
4813 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4814 jclass c = (*env)->GetObjectClass(env, o);
4816 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4817 atomic_init(&calls->refcnt, 1);
4818 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4819 calls->o = (*env)->NewWeakGlobalRef(env, o);
4820 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4821 CHECK(calls->register_tx_meth != NULL);
4822 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4823 CHECK(calls->register_output_meth != NULL);
4826 .this_arg = (void*) calls,
4827 .register_tx = register_tx_jcall,
4828 .register_output = register_output_jcall,
4829 .free = LDKFilter_JCalls_free,
4833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4834 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4835 *res_ptr = LDKFilter_init(env, clz, o);
4836 return (long)res_ptr;
4838 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) {
4839 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4840 unsigned char txid_arr[32];
4841 CHECK((*env)->GetArrayLength(env, txid) == 32);
4842 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4843 unsigned char (*txid_ref)[32] = &txid_arr;
4844 LDKu8slice script_pubkey_ref;
4845 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4846 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4847 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4848 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4851 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) {
4852 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4853 LDKOutPoint outpoint_conv;
4854 outpoint_conv.inner = (void*)(outpoint & (~1));
4855 outpoint_conv.is_owned = false;
4856 LDKu8slice script_pubkey_ref;
4857 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4858 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4859 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4860 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4863 typedef struct LDKPersist_JCalls {
4864 atomic_size_t refcnt;
4867 jmethodID persist_new_channel_meth;
4868 jmethodID update_persisted_channel_meth;
4869 } LDKPersist_JCalls;
4870 static void LDKPersist_JCalls_free(void* this_arg) {
4871 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4872 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4874 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4875 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4879 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4880 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4883 LDKOutPoint id_var = id;
4884 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4885 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4886 long id_ref = (long)id_var.inner;
4887 if (id_var.is_owned) {
4890 LDKChannelMonitor data_var = *data;
4891 data_var = ChannelMonitor_clone(data);
4892 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4893 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4894 long data_ref = (long)data_var.inner;
4895 if (data_var.is_owned) {
4898 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4900 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4901 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4902 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4905 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4906 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4908 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4909 LDKOutPoint id_var = id;
4910 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4911 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4912 long id_ref = (long)id_var.inner;
4913 if (id_var.is_owned) {
4916 LDKChannelMonitorUpdate update_var = *update;
4917 update_var = ChannelMonitorUpdate_clone(update);
4918 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4919 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4920 long update_ref = (long)update_var.inner;
4921 if (update_var.is_owned) {
4924 LDKChannelMonitor data_var = *data;
4925 data_var = ChannelMonitor_clone(data);
4926 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4927 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4928 long data_ref = (long)data_var.inner;
4929 if (data_var.is_owned) {
4932 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4934 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4935 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4936 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4939 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4940 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4941 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4942 return (void*) this_arg;
4944 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
4945 jclass c = (*env)->GetObjectClass(env, o);
4947 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4948 atomic_init(&calls->refcnt, 1);
4949 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4950 calls->o = (*env)->NewWeakGlobalRef(env, o);
4951 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4952 CHECK(calls->persist_new_channel_meth != NULL);
4953 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4954 CHECK(calls->update_persisted_channel_meth != NULL);
4957 .this_arg = (void*) calls,
4958 .persist_new_channel = persist_new_channel_jcall,
4959 .update_persisted_channel = update_persisted_channel_jcall,
4960 .free = LDKPersist_JCalls_free,
4964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
4965 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4966 *res_ptr = LDKPersist_init(env, clz, o);
4967 return (long)res_ptr;
4969 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) {
4970 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4971 LDKOutPoint id_conv;
4972 id_conv.inner = (void*)(id & (~1));
4973 id_conv.is_owned = (id & 1) || (id == 0);
4974 id_conv = OutPoint_clone(&id_conv);
4975 LDKChannelMonitor data_conv;
4976 data_conv.inner = (void*)(data & (~1));
4977 data_conv.is_owned = false;
4978 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4979 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4980 return (long)ret_conv;
4983 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) {
4984 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4985 LDKOutPoint id_conv;
4986 id_conv.inner = (void*)(id & (~1));
4987 id_conv.is_owned = (id & 1) || (id == 0);
4988 id_conv = OutPoint_clone(&id_conv);
4989 LDKChannelMonitorUpdate update_conv;
4990 update_conv.inner = (void*)(update & (~1));
4991 update_conv.is_owned = false;
4992 LDKChannelMonitor data_conv;
4993 data_conv.inner = (void*)(data & (~1));
4994 data_conv.is_owned = false;
4995 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4996 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4997 return (long)ret_conv;
5000 typedef struct LDKChannelMessageHandler_JCalls {
5001 atomic_size_t refcnt;
5004 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5005 jmethodID handle_open_channel_meth;
5006 jmethodID handle_accept_channel_meth;
5007 jmethodID handle_funding_created_meth;
5008 jmethodID handle_funding_signed_meth;
5009 jmethodID handle_funding_locked_meth;
5010 jmethodID handle_shutdown_meth;
5011 jmethodID handle_closing_signed_meth;
5012 jmethodID handle_update_add_htlc_meth;
5013 jmethodID handle_update_fulfill_htlc_meth;
5014 jmethodID handle_update_fail_htlc_meth;
5015 jmethodID handle_update_fail_malformed_htlc_meth;
5016 jmethodID handle_commitment_signed_meth;
5017 jmethodID handle_revoke_and_ack_meth;
5018 jmethodID handle_update_fee_meth;
5019 jmethodID handle_announcement_signatures_meth;
5020 jmethodID peer_disconnected_meth;
5021 jmethodID peer_connected_meth;
5022 jmethodID handle_channel_reestablish_meth;
5023 jmethodID handle_error_meth;
5024 } LDKChannelMessageHandler_JCalls;
5025 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5026 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5027 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5029 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5030 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5034 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5035 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5037 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5038 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5039 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5040 LDKInitFeatures their_features_var = their_features;
5041 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5042 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5043 long their_features_ref = (long)their_features_var.inner;
5044 if (their_features_var.is_owned) {
5045 their_features_ref |= 1;
5047 LDKOpenChannel msg_var = *msg;
5048 msg_var = OpenChannel_clone(msg);
5049 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5050 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5051 long msg_ref = (long)msg_var.inner;
5052 if (msg_var.is_owned) {
5055 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5057 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5059 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5060 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5062 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5063 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5064 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5065 LDKInitFeatures their_features_var = their_features;
5066 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5067 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5068 long their_features_ref = (long)their_features_var.inner;
5069 if (their_features_var.is_owned) {
5070 their_features_ref |= 1;
5072 LDKAcceptChannel msg_var = *msg;
5073 msg_var = AcceptChannel_clone(msg);
5074 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5075 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5076 long msg_ref = (long)msg_var.inner;
5077 if (msg_var.is_owned) {
5080 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5082 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5084 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5087 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5088 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5089 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5090 LDKFundingCreated msg_var = *msg;
5091 msg_var = FundingCreated_clone(msg);
5092 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5093 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5094 long msg_ref = (long)msg_var.inner;
5095 if (msg_var.is_owned) {
5098 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5100 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5102 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5103 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5105 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5106 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5107 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5108 LDKFundingSigned msg_var = *msg;
5109 msg_var = FundingSigned_clone(msg);
5110 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5111 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5112 long msg_ref = (long)msg_var.inner;
5113 if (msg_var.is_owned) {
5116 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5118 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5120 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5121 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5123 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5124 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5125 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5126 LDKFundingLocked msg_var = *msg;
5127 msg_var = FundingLocked_clone(msg);
5128 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5129 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5130 long msg_ref = (long)msg_var.inner;
5131 if (msg_var.is_owned) {
5134 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5136 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5138 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5139 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5141 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5142 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5143 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5144 LDKInitFeatures their_features_var = *their_features;
5145 their_features_var = InitFeatures_clone(their_features);
5146 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5147 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5148 long their_features_ref = (long)their_features_var.inner;
5149 if (their_features_var.is_owned) {
5150 their_features_ref |= 1;
5152 LDKShutdown msg_var = *msg;
5153 msg_var = Shutdown_clone(msg);
5154 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5155 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5156 long msg_ref = (long)msg_var.inner;
5157 if (msg_var.is_owned) {
5160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5162 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5164 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5165 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5167 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5168 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5169 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5170 LDKClosingSigned msg_var = *msg;
5171 msg_var = ClosingSigned_clone(msg);
5172 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5173 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5174 long msg_ref = (long)msg_var.inner;
5175 if (msg_var.is_owned) {
5178 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5180 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5182 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5183 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5185 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5186 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5187 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5188 LDKUpdateAddHTLC msg_var = *msg;
5189 msg_var = UpdateAddHTLC_clone(msg);
5190 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5191 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5192 long msg_ref = (long)msg_var.inner;
5193 if (msg_var.is_owned) {
5196 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5198 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5200 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5201 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5203 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5204 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5205 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5206 LDKUpdateFulfillHTLC msg_var = *msg;
5207 msg_var = UpdateFulfillHTLC_clone(msg);
5208 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5209 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5210 long msg_ref = (long)msg_var.inner;
5211 if (msg_var.is_owned) {
5214 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5216 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5218 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5221 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5222 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5223 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5224 LDKUpdateFailHTLC msg_var = *msg;
5225 msg_var = UpdateFailHTLC_clone(msg);
5226 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5227 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5228 long msg_ref = (long)msg_var.inner;
5229 if (msg_var.is_owned) {
5232 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5234 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5236 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5237 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5239 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5240 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5241 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5242 LDKUpdateFailMalformedHTLC msg_var = *msg;
5243 msg_var = UpdateFailMalformedHTLC_clone(msg);
5244 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5245 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5246 long msg_ref = (long)msg_var.inner;
5247 if (msg_var.is_owned) {
5250 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5252 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5254 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5255 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5257 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5258 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5259 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5260 LDKCommitmentSigned msg_var = *msg;
5261 msg_var = CommitmentSigned_clone(msg);
5262 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5263 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5264 long msg_ref = (long)msg_var.inner;
5265 if (msg_var.is_owned) {
5268 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5270 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5272 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5273 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5275 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5276 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5277 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5278 LDKRevokeAndACK msg_var = *msg;
5279 msg_var = RevokeAndACK_clone(msg);
5280 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5281 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5282 long msg_ref = (long)msg_var.inner;
5283 if (msg_var.is_owned) {
5286 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5288 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5290 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5291 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5294 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5295 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5296 LDKUpdateFee msg_var = *msg;
5297 msg_var = UpdateFee_clone(msg);
5298 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5299 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5300 long msg_ref = (long)msg_var.inner;
5301 if (msg_var.is_owned) {
5304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5306 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5308 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5309 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5311 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5312 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5313 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5314 LDKAnnouncementSignatures msg_var = *msg;
5315 msg_var = AnnouncementSignatures_clone(msg);
5316 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5317 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5318 long msg_ref = (long)msg_var.inner;
5319 if (msg_var.is_owned) {
5322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5324 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5326 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5327 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5329 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5330 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5331 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5334 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5336 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5337 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5339 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5340 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5341 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5342 LDKInit msg_var = *msg;
5343 msg_var = Init_clone(msg);
5344 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5345 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5346 long msg_ref = (long)msg_var.inner;
5347 if (msg_var.is_owned) {
5350 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5352 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5354 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5355 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5358 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5359 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5360 LDKChannelReestablish msg_var = *msg;
5361 msg_var = ChannelReestablish_clone(msg);
5362 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5363 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5364 long msg_ref = (long)msg_var.inner;
5365 if (msg_var.is_owned) {
5368 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5370 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5372 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5373 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5376 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5377 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5378 LDKErrorMessage msg_var = *msg;
5379 msg_var = ErrorMessage_clone(msg);
5380 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5381 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5382 long msg_ref = (long)msg_var.inner;
5383 if (msg_var.is_owned) {
5386 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5388 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5390 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
5391 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5392 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5393 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5394 return (void*) this_arg;
5396 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5397 jclass c = (*env)->GetObjectClass(env, o);
5399 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5400 atomic_init(&calls->refcnt, 1);
5401 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5402 calls->o = (*env)->NewWeakGlobalRef(env, o);
5403 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
5404 CHECK(calls->handle_open_channel_meth != NULL);
5405 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
5406 CHECK(calls->handle_accept_channel_meth != NULL);
5407 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
5408 CHECK(calls->handle_funding_created_meth != NULL);
5409 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
5410 CHECK(calls->handle_funding_signed_meth != NULL);
5411 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
5412 CHECK(calls->handle_funding_locked_meth != NULL);
5413 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
5414 CHECK(calls->handle_shutdown_meth != NULL);
5415 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
5416 CHECK(calls->handle_closing_signed_meth != NULL);
5417 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
5418 CHECK(calls->handle_update_add_htlc_meth != NULL);
5419 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
5420 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
5421 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
5422 CHECK(calls->handle_update_fail_htlc_meth != NULL);
5423 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
5424 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
5425 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
5426 CHECK(calls->handle_commitment_signed_meth != NULL);
5427 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
5428 CHECK(calls->handle_revoke_and_ack_meth != NULL);
5429 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
5430 CHECK(calls->handle_update_fee_meth != NULL);
5431 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
5432 CHECK(calls->handle_announcement_signatures_meth != NULL);
5433 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
5434 CHECK(calls->peer_disconnected_meth != NULL);
5435 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
5436 CHECK(calls->peer_connected_meth != NULL);
5437 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
5438 CHECK(calls->handle_channel_reestablish_meth != NULL);
5439 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
5440 CHECK(calls->handle_error_meth != NULL);
5442 LDKChannelMessageHandler ret = {
5443 .this_arg = (void*) calls,
5444 .handle_open_channel = handle_open_channel_jcall,
5445 .handle_accept_channel = handle_accept_channel_jcall,
5446 .handle_funding_created = handle_funding_created_jcall,
5447 .handle_funding_signed = handle_funding_signed_jcall,
5448 .handle_funding_locked = handle_funding_locked_jcall,
5449 .handle_shutdown = handle_shutdown_jcall,
5450 .handle_closing_signed = handle_closing_signed_jcall,
5451 .handle_update_add_htlc = handle_update_add_htlc_jcall,
5452 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
5453 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
5454 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
5455 .handle_commitment_signed = handle_commitment_signed_jcall,
5456 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
5457 .handle_update_fee = handle_update_fee_jcall,
5458 .handle_announcement_signatures = handle_announcement_signatures_jcall,
5459 .peer_disconnected = peer_disconnected_jcall,
5460 .peer_connected = peer_connected_jcall,
5461 .handle_channel_reestablish = handle_channel_reestablish_jcall,
5462 .handle_error = handle_error_jcall,
5463 .free = LDKChannelMessageHandler_JCalls_free,
5464 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5466 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5470 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5471 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5472 return (long)res_ptr;
5474 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) {
5475 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5476 LDKPublicKey their_node_id_ref;
5477 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5478 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5479 LDKInitFeatures their_features_conv;
5480 their_features_conv.inner = (void*)(their_features & (~1));
5481 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5482 their_features_conv = InitFeatures_clone(&their_features_conv);
5483 LDKOpenChannel msg_conv;
5484 msg_conv.inner = (void*)(msg & (~1));
5485 msg_conv.is_owned = false;
5486 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5489 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) {
5490 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5491 LDKPublicKey their_node_id_ref;
5492 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5493 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5494 LDKInitFeatures their_features_conv;
5495 their_features_conv.inner = (void*)(their_features & (~1));
5496 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5497 their_features_conv = InitFeatures_clone(&their_features_conv);
5498 LDKAcceptChannel msg_conv;
5499 msg_conv.inner = (void*)(msg & (~1));
5500 msg_conv.is_owned = false;
5501 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5504 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) {
5505 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5506 LDKPublicKey their_node_id_ref;
5507 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5508 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5509 LDKFundingCreated msg_conv;
5510 msg_conv.inner = (void*)(msg & (~1));
5511 msg_conv.is_owned = false;
5512 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5515 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) {
5516 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5517 LDKPublicKey their_node_id_ref;
5518 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5519 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5520 LDKFundingSigned msg_conv;
5521 msg_conv.inner = (void*)(msg & (~1));
5522 msg_conv.is_owned = false;
5523 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5526 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) {
5527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5528 LDKPublicKey their_node_id_ref;
5529 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5530 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5531 LDKFundingLocked msg_conv;
5532 msg_conv.inner = (void*)(msg & (~1));
5533 msg_conv.is_owned = false;
5534 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
5538 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5539 LDKPublicKey their_node_id_ref;
5540 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5541 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5542 LDKInitFeatures their_features_conv;
5543 their_features_conv.inner = (void*)(their_features & (~1));
5544 their_features_conv.is_owned = false;
5545 LDKShutdown msg_conv;
5546 msg_conv.inner = (void*)(msg & (~1));
5547 msg_conv.is_owned = false;
5548 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5551 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) {
5552 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5553 LDKPublicKey their_node_id_ref;
5554 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5555 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5556 LDKClosingSigned msg_conv;
5557 msg_conv.inner = (void*)(msg & (~1));
5558 msg_conv.is_owned = false;
5559 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5562 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) {
5563 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5564 LDKPublicKey their_node_id_ref;
5565 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5566 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5567 LDKUpdateAddHTLC msg_conv;
5568 msg_conv.inner = (void*)(msg & (~1));
5569 msg_conv.is_owned = false;
5570 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5573 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) {
5574 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5575 LDKPublicKey their_node_id_ref;
5576 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5577 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5578 LDKUpdateFulfillHTLC msg_conv;
5579 msg_conv.inner = (void*)(msg & (~1));
5580 msg_conv.is_owned = false;
5581 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5584 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) {
5585 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5586 LDKPublicKey their_node_id_ref;
5587 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5588 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5589 LDKUpdateFailHTLC msg_conv;
5590 msg_conv.inner = (void*)(msg & (~1));
5591 msg_conv.is_owned = false;
5592 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5595 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) {
5596 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5597 LDKPublicKey their_node_id_ref;
5598 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5599 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5600 LDKUpdateFailMalformedHTLC msg_conv;
5601 msg_conv.inner = (void*)(msg & (~1));
5602 msg_conv.is_owned = false;
5603 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5606 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) {
5607 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5608 LDKPublicKey their_node_id_ref;
5609 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5610 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5611 LDKCommitmentSigned msg_conv;
5612 msg_conv.inner = (void*)(msg & (~1));
5613 msg_conv.is_owned = false;
5614 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5617 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) {
5618 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5619 LDKPublicKey their_node_id_ref;
5620 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5621 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5622 LDKRevokeAndACK msg_conv;
5623 msg_conv.inner = (void*)(msg & (~1));
5624 msg_conv.is_owned = false;
5625 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5628 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) {
5629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5630 LDKPublicKey their_node_id_ref;
5631 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5632 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5633 LDKUpdateFee msg_conv;
5634 msg_conv.inner = (void*)(msg & (~1));
5635 msg_conv.is_owned = false;
5636 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5639 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) {
5640 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5641 LDKPublicKey their_node_id_ref;
5642 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5643 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5644 LDKAnnouncementSignatures msg_conv;
5645 msg_conv.inner = (void*)(msg & (~1));
5646 msg_conv.is_owned = false;
5647 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5650 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) {
5651 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5652 LDKPublicKey their_node_id_ref;
5653 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5654 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5655 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5658 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) {
5659 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5660 LDKPublicKey their_node_id_ref;
5661 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5662 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5664 msg_conv.inner = (void*)(msg & (~1));
5665 msg_conv.is_owned = false;
5666 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5669 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) {
5670 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5671 LDKPublicKey their_node_id_ref;
5672 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5673 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5674 LDKChannelReestablish msg_conv;
5675 msg_conv.inner = (void*)(msg & (~1));
5676 msg_conv.is_owned = false;
5677 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5680 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) {
5681 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5682 LDKPublicKey their_node_id_ref;
5683 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5684 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5685 LDKErrorMessage msg_conv;
5686 msg_conv.inner = (void*)(msg & (~1));
5687 msg_conv.is_owned = false;
5688 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5691 typedef struct LDKRoutingMessageHandler_JCalls {
5692 atomic_size_t refcnt;
5695 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5696 jmethodID handle_node_announcement_meth;
5697 jmethodID handle_channel_announcement_meth;
5698 jmethodID handle_channel_update_meth;
5699 jmethodID handle_htlc_fail_channel_update_meth;
5700 jmethodID get_next_channel_announcements_meth;
5701 jmethodID get_next_node_announcements_meth;
5702 jmethodID sync_routing_table_meth;
5703 jmethodID handle_reply_channel_range_meth;
5704 jmethodID handle_reply_short_channel_ids_end_meth;
5705 jmethodID handle_query_channel_range_meth;
5706 jmethodID handle_query_short_channel_ids_meth;
5707 } LDKRoutingMessageHandler_JCalls;
5708 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5709 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5710 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5712 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5713 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5717 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5718 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5720 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5721 LDKNodeAnnouncement msg_var = *msg;
5722 msg_var = NodeAnnouncement_clone(msg);
5723 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5724 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5725 long msg_ref = (long)msg_var.inner;
5726 if (msg_var.is_owned) {
5729 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5731 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5732 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5733 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5736 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5737 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5739 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5740 LDKChannelAnnouncement msg_var = *msg;
5741 msg_var = ChannelAnnouncement_clone(msg);
5742 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5743 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5744 long msg_ref = (long)msg_var.inner;
5745 if (msg_var.is_owned) {
5748 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5750 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5751 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5752 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5755 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5756 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5758 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5759 LDKChannelUpdate msg_var = *msg;
5760 msg_var = ChannelUpdate_clone(msg);
5761 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5762 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5763 long msg_ref = (long)msg_var.inner;
5764 if (msg_var.is_owned) {
5767 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5769 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5770 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5771 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5774 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5775 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5777 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5778 long ret_update = (long)update;
5779 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5781 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5783 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5784 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5786 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5787 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5789 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5790 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5791 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5792 if (ret_constr.datalen > 0)
5793 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5795 ret_constr.data = NULL;
5796 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5797 for (size_t l = 0; l < ret_constr.datalen; l++) {
5798 int64_t ret_conv_63 = ret_vals[l];
5799 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5800 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
5801 ret_constr.data[l] = ret_conv_63_conv;
5803 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5806 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5807 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5809 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5810 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5811 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5812 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5814 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5815 LDKCVec_NodeAnnouncementZ ret_constr;
5816 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5817 if (ret_constr.datalen > 0)
5818 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5820 ret_constr.data = NULL;
5821 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5822 for (size_t s = 0; s < ret_constr.datalen; s++) {
5823 int64_t ret_conv_18 = ret_vals[s];
5824 LDKNodeAnnouncement ret_conv_18_conv;
5825 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5826 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5827 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5828 ret_constr.data[s] = ret_conv_18_conv;
5830 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5833 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5834 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5837 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5838 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5839 LDKInit init_var = *init;
5840 init_var = Init_clone(init);
5841 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5842 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5843 long init_ref = (long)init_var.inner;
5844 if (init_var.is_owned) {
5847 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5849 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5851 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5852 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5855 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5856 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5857 LDKReplyChannelRange msg_var = msg;
5858 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5859 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5860 long msg_ref = (long)msg_var.inner;
5861 if (msg_var.is_owned) {
5864 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5866 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5867 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5868 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5871 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5872 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5874 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5875 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5876 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5877 LDKReplyShortChannelIdsEnd msg_var = msg;
5878 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5879 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5880 long msg_ref = (long)msg_var.inner;
5881 if (msg_var.is_owned) {
5884 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5886 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5887 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5888 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5891 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5892 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5894 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5895 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5896 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5897 LDKQueryChannelRange msg_var = msg;
5898 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5899 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5900 long msg_ref = (long)msg_var.inner;
5901 if (msg_var.is_owned) {
5904 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5906 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5907 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5908 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5911 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5912 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5914 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5915 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5916 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5917 LDKQueryShortChannelIds msg_var = msg;
5918 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5919 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5920 long msg_ref = (long)msg_var.inner;
5921 if (msg_var.is_owned) {
5924 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5926 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5927 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5928 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5931 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5932 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5933 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5934 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5935 return (void*) this_arg;
5937 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5938 jclass c = (*env)->GetObjectClass(env, o);
5940 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5941 atomic_init(&calls->refcnt, 1);
5942 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5943 calls->o = (*env)->NewWeakGlobalRef(env, o);
5944 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5945 CHECK(calls->handle_node_announcement_meth != NULL);
5946 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5947 CHECK(calls->handle_channel_announcement_meth != NULL);
5948 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5949 CHECK(calls->handle_channel_update_meth != NULL);
5950 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5951 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5952 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5953 CHECK(calls->get_next_channel_announcements_meth != NULL);
5954 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5955 CHECK(calls->get_next_node_announcements_meth != NULL);
5956 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5957 CHECK(calls->sync_routing_table_meth != NULL);
5958 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5959 CHECK(calls->handle_reply_channel_range_meth != NULL);
5960 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5961 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5962 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5963 CHECK(calls->handle_query_channel_range_meth != NULL);
5964 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5965 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5967 LDKRoutingMessageHandler ret = {
5968 .this_arg = (void*) calls,
5969 .handle_node_announcement = handle_node_announcement_jcall,
5970 .handle_channel_announcement = handle_channel_announcement_jcall,
5971 .handle_channel_update = handle_channel_update_jcall,
5972 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5973 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5974 .get_next_node_announcements = get_next_node_announcements_jcall,
5975 .sync_routing_table = sync_routing_table_jcall,
5976 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5977 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5978 .handle_query_channel_range = handle_query_channel_range_jcall,
5979 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5980 .free = LDKRoutingMessageHandler_JCalls_free,
5981 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5983 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5987 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5988 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5989 return (long)res_ptr;
5991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5992 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5993 LDKNodeAnnouncement msg_conv;
5994 msg_conv.inner = (void*)(msg & (~1));
5995 msg_conv.is_owned = false;
5996 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5997 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5998 return (long)ret_conv;
6001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6002 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6003 LDKChannelAnnouncement msg_conv;
6004 msg_conv.inner = (void*)(msg & (~1));
6005 msg_conv.is_owned = false;
6006 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6007 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6008 return (long)ret_conv;
6011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6012 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6013 LDKChannelUpdate msg_conv;
6014 msg_conv.inner = (void*)(msg & (~1));
6015 msg_conv.is_owned = false;
6016 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6017 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6018 return (long)ret_conv;
6021 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) {
6022 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6023 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6024 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6027 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) {
6028 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6029 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6030 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6031 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6032 for (size_t l = 0; l < ret_var.datalen; l++) {
6033 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6034 *ret_conv_63_ref = ret_var.data[l];
6035 ret_arr_ptr[l] = (long)ret_conv_63_ref;
6037 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6042 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) {
6043 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6044 LDKPublicKey starting_point_ref;
6045 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
6046 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
6047 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6048 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6049 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6050 for (size_t s = 0; s < ret_var.datalen; s++) {
6051 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6052 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6053 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6054 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
6055 if (ret_conv_18_var.is_owned) {
6056 ret_conv_18_ref |= 1;
6058 ret_arr_ptr[s] = ret_conv_18_ref;
6060 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6065 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) {
6066 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6067 LDKPublicKey their_node_id_ref;
6068 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6069 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6071 init_conv.inner = (void*)(init & (~1));
6072 init_conv.is_owned = false;
6073 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6076 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) {
6077 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6078 LDKPublicKey their_node_id_ref;
6079 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6080 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6081 LDKReplyChannelRange msg_conv;
6082 msg_conv.inner = (void*)(msg & (~1));
6083 msg_conv.is_owned = (msg & 1) || (msg == 0);
6084 msg_conv = ReplyChannelRange_clone(&msg_conv);
6085 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6086 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6087 return (long)ret_conv;
6090 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) {
6091 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6092 LDKPublicKey their_node_id_ref;
6093 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6094 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6095 LDKReplyShortChannelIdsEnd msg_conv;
6096 msg_conv.inner = (void*)(msg & (~1));
6097 msg_conv.is_owned = (msg & 1) || (msg == 0);
6098 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6099 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6100 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6101 return (long)ret_conv;
6104 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) {
6105 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6106 LDKPublicKey their_node_id_ref;
6107 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6108 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6109 LDKQueryChannelRange msg_conv;
6110 msg_conv.inner = (void*)(msg & (~1));
6111 msg_conv.is_owned = (msg & 1) || (msg == 0);
6112 msg_conv = QueryChannelRange_clone(&msg_conv);
6113 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6114 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6115 return (long)ret_conv;
6118 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) {
6119 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
6120 LDKPublicKey their_node_id_ref;
6121 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6122 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6123 LDKQueryShortChannelIds msg_conv;
6124 msg_conv.inner = (void*)(msg & (~1));
6125 msg_conv.is_owned = (msg & 1) || (msg == 0);
6126 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6127 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6128 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6129 return (long)ret_conv;
6132 typedef struct LDKSocketDescriptor_JCalls {
6133 atomic_size_t refcnt;
6136 jmethodID send_data_meth;
6137 jmethodID disconnect_socket_meth;
6139 jmethodID hash_meth;
6140 } LDKSocketDescriptor_JCalls;
6141 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6142 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6143 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6146 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6150 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6151 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6153 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6154 LDKu8slice data_var = data;
6155 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
6156 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
6157 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6159 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
6161 void disconnect_socket_jcall(void* this_arg) {
6162 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6164 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6165 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6167 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
6169 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6170 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6172 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6173 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6174 *other_arg_clone = SocketDescriptor_clone(other_arg);
6175 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6177 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
6179 uint64_t hash_jcall(const void* this_arg) {
6180 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6182 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6183 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6185 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
6187 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
6188 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6189 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6190 return (void*) this_arg;
6192 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
6193 jclass c = (*env)->GetObjectClass(env, o);
6195 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6196 atomic_init(&calls->refcnt, 1);
6197 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6198 calls->o = (*env)->NewWeakGlobalRef(env, o);
6199 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
6200 CHECK(calls->send_data_meth != NULL);
6201 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
6202 CHECK(calls->disconnect_socket_meth != NULL);
6203 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
6204 CHECK(calls->eq_meth != NULL);
6205 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
6206 CHECK(calls->hash_meth != NULL);
6208 LDKSocketDescriptor ret = {
6209 .this_arg = (void*) calls,
6210 .send_data = send_data_jcall,
6211 .disconnect_socket = disconnect_socket_jcall,
6214 .clone = LDKSocketDescriptor_JCalls_clone,
6215 .free = LDKSocketDescriptor_JCalls_free,
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
6220 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6221 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
6222 return (long)res_ptr;
6224 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) {
6225 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
6226 LDKu8slice data_ref;
6227 data_ref.datalen = (*env)->GetArrayLength(env, data);
6228 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
6229 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6230 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
6234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
6235 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
6236 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
6240 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
6241 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6246 LDKTransaction _res_ref;
6247 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6248 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6249 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6250 _res_ref.data_is_owned = true;
6251 Transaction_free(_res_ref);
6254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
6255 if ((_res & 1) != 0) return;
6256 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6258 TxOut_free(_res_conv);
6261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6262 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6263 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6264 *ret_ref = TxOut_clone(orig_conv);
6265 return (long)ret_ref;
6268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6270 CHECK((*env)->GetArrayLength(env, o) == 32);
6271 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6272 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6273 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6274 return (long)ret_conv;
6277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6278 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6279 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6280 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6281 return (long)ret_conv;
6284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6285 if ((_res & 1) != 0) return;
6286 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6288 CResult_SecretKeyErrorZ_free(_res_conv);
6291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6293 CHECK((*env)->GetArrayLength(env, o) == 33);
6294 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6295 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6296 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6297 return (long)ret_conv;
6300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6301 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6302 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6303 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6304 return (long)ret_conv;
6307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6308 if ((_res & 1) != 0) return;
6309 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6311 CResult_PublicKeyErrorZ_free(_res_conv);
6314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6315 LDKTxCreationKeys o_conv;
6316 o_conv.inner = (void*)(o & (~1));
6317 o_conv.is_owned = (o & 1) || (o == 0);
6318 o_conv = TxCreationKeys_clone(&o_conv);
6319 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6320 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6321 return (long)ret_conv;
6324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6325 LDKDecodeError e_conv;
6326 e_conv.inner = (void*)(e & (~1));
6327 e_conv.is_owned = (e & 1) || (e == 0);
6328 e_conv = DecodeError_clone(&e_conv);
6329 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6330 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6331 return (long)ret_conv;
6334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6335 if ((_res & 1) != 0) return;
6336 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6338 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6342 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6343 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6344 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6345 return (long)ret_conv;
6348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6349 LDKChannelPublicKeys o_conv;
6350 o_conv.inner = (void*)(o & (~1));
6351 o_conv.is_owned = (o & 1) || (o == 0);
6352 o_conv = ChannelPublicKeys_clone(&o_conv);
6353 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6354 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6355 return (long)ret_conv;
6358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6359 LDKDecodeError e_conv;
6360 e_conv.inner = (void*)(e & (~1));
6361 e_conv.is_owned = (e & 1) || (e == 0);
6362 e_conv = DecodeError_clone(&e_conv);
6363 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6364 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6365 return (long)ret_conv;
6368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6369 if ((_res & 1) != 0) return;
6370 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6372 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6376 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6377 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6378 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6379 return (long)ret_conv;
6382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6383 LDKTxCreationKeys o_conv;
6384 o_conv.inner = (void*)(o & (~1));
6385 o_conv.is_owned = (o & 1) || (o == 0);
6386 o_conv = TxCreationKeys_clone(&o_conv);
6387 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6388 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6389 return (long)ret_conv;
6392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6393 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6394 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6395 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6396 return (long)ret_conv;
6399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6400 if ((_res & 1) != 0) return;
6401 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6403 CResult_TxCreationKeysErrorZ_free(_res_conv);
6406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6407 LDKHTLCOutputInCommitment o_conv;
6408 o_conv.inner = (void*)(o & (~1));
6409 o_conv.is_owned = (o & 1) || (o == 0);
6410 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6411 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6412 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6413 return (long)ret_conv;
6416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6417 LDKDecodeError e_conv;
6418 e_conv.inner = (void*)(e & (~1));
6419 e_conv.is_owned = (e & 1) || (e == 0);
6420 e_conv = DecodeError_clone(&e_conv);
6421 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6422 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6423 return (long)ret_conv;
6426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6427 if ((_res & 1) != 0) return;
6428 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6430 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6434 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6435 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6436 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6437 return (long)ret_conv;
6440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6441 LDKCounterpartyChannelTransactionParameters o_conv;
6442 o_conv.inner = (void*)(o & (~1));
6443 o_conv.is_owned = (o & 1) || (o == 0);
6444 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6445 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6446 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6447 return (long)ret_conv;
6450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6451 LDKDecodeError e_conv;
6452 e_conv.inner = (void*)(e & (~1));
6453 e_conv.is_owned = (e & 1) || (e == 0);
6454 e_conv = DecodeError_clone(&e_conv);
6455 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6456 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6457 return (long)ret_conv;
6460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6461 if ((_res & 1) != 0) return;
6462 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6464 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6468 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6469 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6470 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6471 return (long)ret_conv;
6474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6475 LDKChannelTransactionParameters o_conv;
6476 o_conv.inner = (void*)(o & (~1));
6477 o_conv.is_owned = (o & 1) || (o == 0);
6478 o_conv = ChannelTransactionParameters_clone(&o_conv);
6479 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6480 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6481 return (long)ret_conv;
6484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6485 LDKDecodeError e_conv;
6486 e_conv.inner = (void*)(e & (~1));
6487 e_conv.is_owned = (e & 1) || (e == 0);
6488 e_conv = DecodeError_clone(&e_conv);
6489 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6490 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6491 return (long)ret_conv;
6494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6495 if ((_res & 1) != 0) return;
6496 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6498 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6502 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6503 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6504 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6505 return (long)ret_conv;
6508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6509 LDKCVec_SignatureZ _res_constr;
6510 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6511 if (_res_constr.datalen > 0)
6512 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6514 _res_constr.data = NULL;
6515 for (size_t i = 0; i < _res_constr.datalen; i++) {
6516 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6517 LDKSignature _res_conv_8_ref;
6518 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
6519 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
6520 _res_constr.data[i] = _res_conv_8_ref;
6522 CVec_SignatureZ_free(_res_constr);
6525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6526 LDKHolderCommitmentTransaction o_conv;
6527 o_conv.inner = (void*)(o & (~1));
6528 o_conv.is_owned = (o & 1) || (o == 0);
6529 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6530 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6531 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6532 return (long)ret_conv;
6535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6536 LDKDecodeError e_conv;
6537 e_conv.inner = (void*)(e & (~1));
6538 e_conv.is_owned = (e & 1) || (e == 0);
6539 e_conv = DecodeError_clone(&e_conv);
6540 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6541 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6542 return (long)ret_conv;
6545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6546 if ((_res & 1) != 0) return;
6547 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6549 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6553 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6554 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6555 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6556 return (long)ret_conv;
6559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6560 LDKBuiltCommitmentTransaction o_conv;
6561 o_conv.inner = (void*)(o & (~1));
6562 o_conv.is_owned = (o & 1) || (o == 0);
6563 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6564 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6565 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6566 return (long)ret_conv;
6569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6570 LDKDecodeError e_conv;
6571 e_conv.inner = (void*)(e & (~1));
6572 e_conv.is_owned = (e & 1) || (e == 0);
6573 e_conv = DecodeError_clone(&e_conv);
6574 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6575 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6576 return (long)ret_conv;
6579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6580 if ((_res & 1) != 0) return;
6581 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6583 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6587 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6588 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6589 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6590 return (long)ret_conv;
6593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6594 LDKCommitmentTransaction o_conv;
6595 o_conv.inner = (void*)(o & (~1));
6596 o_conv.is_owned = (o & 1) || (o == 0);
6597 o_conv = CommitmentTransaction_clone(&o_conv);
6598 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6599 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6600 return (long)ret_conv;
6603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6604 LDKDecodeError e_conv;
6605 e_conv.inner = (void*)(e & (~1));
6606 e_conv.is_owned = (e & 1) || (e == 0);
6607 e_conv = DecodeError_clone(&e_conv);
6608 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6609 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6610 return (long)ret_conv;
6613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6614 if ((_res & 1) != 0) return;
6615 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6617 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6621 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6622 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6623 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6624 return (long)ret_conv;
6627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6628 LDKTrustedCommitmentTransaction o_conv;
6629 o_conv.inner = (void*)(o & (~1));
6630 o_conv.is_owned = (o & 1) || (o == 0);
6631 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6632 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6633 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6634 return (long)ret_conv;
6637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6638 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6639 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6640 return (long)ret_conv;
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6644 if ((_res & 1) != 0) return;
6645 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6647 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6651 LDKCVec_SignatureZ o_constr;
6652 o_constr.datalen = (*env)->GetArrayLength(env, o);
6653 if (o_constr.datalen > 0)
6654 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6656 o_constr.data = NULL;
6657 for (size_t i = 0; i < o_constr.datalen; i++) {
6658 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6659 LDKSignature o_conv_8_ref;
6660 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
6661 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
6662 o_constr.data[i] = o_conv_8_ref;
6664 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6665 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6666 return (long)ret_conv;
6669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6670 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6671 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6672 return (long)ret_conv;
6675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6676 if ((_res & 1) != 0) return;
6677 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6679 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6683 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6684 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6685 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6686 return (long)ret_conv;
6689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6690 LDKCVec_MessageSendEventZ _res_constr;
6691 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6692 if (_res_constr.datalen > 0)
6693 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6695 _res_constr.data = NULL;
6696 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6697 for (size_t s = 0; s < _res_constr.datalen; s++) {
6698 int64_t _res_conv_18 = _res_vals[s];
6699 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6700 FREE((void*)_res_conv_18);
6701 _res_constr.data[s] = _res_conv_18_conv;
6703 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6704 CVec_MessageSendEventZ_free(_res_constr);
6707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6708 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6709 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6710 return (long)ret_conv;
6713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6714 LDKLightningError e_conv;
6715 e_conv.inner = (void*)(e & (~1));
6716 e_conv.is_owned = (e & 1) || (e == 0);
6717 e_conv = LightningError_clone(&e_conv);
6718 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6719 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6720 return (long)ret_conv;
6723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6724 if ((_res & 1) != 0) return;
6725 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6727 CResult_boolLightningErrorZ_free(_res_conv);
6730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6731 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6732 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6733 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6734 return (long)ret_conv;
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6738 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6739 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6740 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6741 return (long)ret_ref;
6744 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) {
6745 LDKChannelAnnouncement a_conv;
6746 a_conv.inner = (void*)(a & (~1));
6747 a_conv.is_owned = (a & 1) || (a == 0);
6748 a_conv = ChannelAnnouncement_clone(&a_conv);
6749 LDKChannelUpdate b_conv;
6750 b_conv.inner = (void*)(b & (~1));
6751 b_conv.is_owned = (b & 1) || (b == 0);
6752 b_conv = ChannelUpdate_clone(&b_conv);
6753 LDKChannelUpdate c_conv;
6754 c_conv.inner = (void*)(c & (~1));
6755 c_conv.is_owned = (c & 1) || (c == 0);
6756 c_conv = ChannelUpdate_clone(&c_conv);
6757 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6758 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6759 return (long)ret_ref;
6762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6763 if ((_res & 1) != 0) return;
6764 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6766 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6770 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6771 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6772 if (_res_constr.datalen > 0)
6773 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6775 _res_constr.data = NULL;
6776 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6777 for (size_t l = 0; l < _res_constr.datalen; l++) {
6778 int64_t _res_conv_63 = _res_vals[l];
6779 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6780 FREE((void*)_res_conv_63);
6781 _res_constr.data[l] = _res_conv_63_conv;
6783 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6784 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6788 LDKCVec_NodeAnnouncementZ _res_constr;
6789 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6790 if (_res_constr.datalen > 0)
6791 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6793 _res_constr.data = NULL;
6794 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6795 for (size_t s = 0; s < _res_constr.datalen; s++) {
6796 int64_t _res_conv_18 = _res_vals[s];
6797 LDKNodeAnnouncement _res_conv_18_conv;
6798 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6799 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6800 _res_constr.data[s] = _res_conv_18_conv;
6802 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6803 CVec_NodeAnnouncementZ_free(_res_constr);
6806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6807 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6808 *ret_conv = CResult_NoneLightningErrorZ_ok();
6809 return (long)ret_conv;
6812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6813 LDKLightningError e_conv;
6814 e_conv.inner = (void*)(e & (~1));
6815 e_conv.is_owned = (e & 1) || (e == 0);
6816 e_conv = LightningError_clone(&e_conv);
6817 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6818 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6819 return (long)ret_conv;
6822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6823 if ((_res & 1) != 0) return;
6824 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6826 CResult_NoneLightningErrorZ_free(_res_conv);
6829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6830 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6831 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6832 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6833 return (long)ret_conv;
6836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6837 LDKCVec_PublicKeyZ _res_constr;
6838 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6839 if (_res_constr.datalen > 0)
6840 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6842 _res_constr.data = NULL;
6843 for (size_t i = 0; i < _res_constr.datalen; i++) {
6844 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6845 LDKPublicKey _res_conv_8_ref;
6846 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
6847 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
6848 _res_constr.data[i] = _res_conv_8_ref;
6850 CVec_PublicKeyZ_free(_res_constr);
6853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6854 LDKCVec_u8Z _res_ref;
6855 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6856 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6857 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6858 CVec_u8Z_free(_res_ref);
6861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6863 o_ref.datalen = (*env)->GetArrayLength(env, o);
6864 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6865 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6866 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6867 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6868 return (long)ret_conv;
6871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6872 LDKPeerHandleError e_conv;
6873 e_conv.inner = (void*)(e & (~1));
6874 e_conv.is_owned = (e & 1) || (e == 0);
6875 e_conv = PeerHandleError_clone(&e_conv);
6876 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6877 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6878 return (long)ret_conv;
6881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6882 if ((_res & 1) != 0) return;
6883 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6885 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6889 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6890 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6891 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6892 return (long)ret_conv;
6895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6896 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6897 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6898 return (long)ret_conv;
6901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6902 LDKPeerHandleError e_conv;
6903 e_conv.inner = (void*)(e & (~1));
6904 e_conv.is_owned = (e & 1) || (e == 0);
6905 e_conv = PeerHandleError_clone(&e_conv);
6906 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6907 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6908 return (long)ret_conv;
6911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6912 if ((_res & 1) != 0) return;
6913 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6915 CResult_NonePeerHandleErrorZ_free(_res_conv);
6918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6919 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6920 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6921 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6922 return (long)ret_conv;
6925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6926 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6927 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6928 return (long)ret_conv;
6931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6932 LDKPeerHandleError e_conv;
6933 e_conv.inner = (void*)(e & (~1));
6934 e_conv.is_owned = (e & 1) || (e == 0);
6935 e_conv = PeerHandleError_clone(&e_conv);
6936 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6937 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6938 return (long)ret_conv;
6941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6942 if ((_res & 1) != 0) return;
6943 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6945 CResult_boolPeerHandleErrorZ_free(_res_conv);
6948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6949 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6950 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6951 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6952 return (long)ret_conv;
6955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6956 LDKInitFeatures o_conv;
6957 o_conv.inner = (void*)(o & (~1));
6958 o_conv.is_owned = (o & 1) || (o == 0);
6959 o_conv = InitFeatures_clone(&o_conv);
6960 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6961 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
6962 return (long)ret_conv;
6965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6966 LDKDecodeError e_conv;
6967 e_conv.inner = (void*)(e & (~1));
6968 e_conv.is_owned = (e & 1) || (e == 0);
6969 e_conv = DecodeError_clone(&e_conv);
6970 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6971 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
6972 return (long)ret_conv;
6975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6976 if ((_res & 1) != 0) return;
6977 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6979 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
6982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6983 LDKNodeFeatures o_conv;
6984 o_conv.inner = (void*)(o & (~1));
6985 o_conv.is_owned = (o & 1) || (o == 0);
6986 o_conv = NodeFeatures_clone(&o_conv);
6987 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6988 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
6989 return (long)ret_conv;
6992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6993 LDKDecodeError e_conv;
6994 e_conv.inner = (void*)(e & (~1));
6995 e_conv.is_owned = (e & 1) || (e == 0);
6996 e_conv = DecodeError_clone(&e_conv);
6997 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6998 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
6999 return (long)ret_conv;
7002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7003 if ((_res & 1) != 0) return;
7004 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7006 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7010 LDKChannelFeatures o_conv;
7011 o_conv.inner = (void*)(o & (~1));
7012 o_conv.is_owned = (o & 1) || (o == 0);
7013 o_conv = ChannelFeatures_clone(&o_conv);
7014 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7015 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7016 return (long)ret_conv;
7019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_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_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7025 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7026 return (long)ret_conv;
7029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7030 if ((_res & 1) != 0) return;
7031 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7033 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7037 LDKChannelConfig o_conv;
7038 o_conv.inner = (void*)(o & (~1));
7039 o_conv.is_owned = (o & 1) || (o == 0);
7040 o_conv = ChannelConfig_clone(&o_conv);
7041 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7042 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
7043 return (long)ret_conv;
7046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7047 LDKDecodeError e_conv;
7048 e_conv.inner = (void*)(e & (~1));
7049 e_conv.is_owned = (e & 1) || (e == 0);
7050 e_conv = DecodeError_clone(&e_conv);
7051 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7052 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
7053 return (long)ret_conv;
7056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7057 if ((_res & 1) != 0) return;
7058 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
7060 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
7063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7064 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
7065 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7066 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
7067 return (long)ret_conv;
7070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7071 LDKDirectionalChannelInfo o_conv;
7072 o_conv.inner = (void*)(o & (~1));
7073 o_conv.is_owned = (o & 1) || (o == 0);
7074 o_conv = DirectionalChannelInfo_clone(&o_conv);
7075 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7076 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7077 return (long)ret_conv;
7080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7081 LDKDecodeError e_conv;
7082 e_conv.inner = (void*)(e & (~1));
7083 e_conv.is_owned = (e & 1) || (e == 0);
7084 e_conv = DecodeError_clone(&e_conv);
7085 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7086 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7087 return (long)ret_conv;
7090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7091 if ((_res & 1) != 0) return;
7092 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7094 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7098 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7099 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7100 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7101 return (long)ret_conv;
7104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7105 LDKChannelInfo o_conv;
7106 o_conv.inner = (void*)(o & (~1));
7107 o_conv.is_owned = (o & 1) || (o == 0);
7108 o_conv = ChannelInfo_clone(&o_conv);
7109 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7110 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7111 return (long)ret_conv;
7114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7115 LDKDecodeError e_conv;
7116 e_conv.inner = (void*)(e & (~1));
7117 e_conv.is_owned = (e & 1) || (e == 0);
7118 e_conv = DecodeError_clone(&e_conv);
7119 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7120 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7121 return (long)ret_conv;
7124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7125 if ((_res & 1) != 0) return;
7126 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7128 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7132 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7133 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7134 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7135 return (long)ret_conv;
7138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7139 LDKRoutingFees o_conv;
7140 o_conv.inner = (void*)(o & (~1));
7141 o_conv.is_owned = (o & 1) || (o == 0);
7142 o_conv = RoutingFees_clone(&o_conv);
7143 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7144 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7145 return (long)ret_conv;
7148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7149 LDKDecodeError e_conv;
7150 e_conv.inner = (void*)(e & (~1));
7151 e_conv.is_owned = (e & 1) || (e == 0);
7152 e_conv = DecodeError_clone(&e_conv);
7153 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7154 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7155 return (long)ret_conv;
7158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7159 if ((_res & 1) != 0) return;
7160 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7162 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7166 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7167 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7168 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7169 return (long)ret_conv;
7172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7173 LDKCVec_NetAddressZ _res_constr;
7174 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7175 if (_res_constr.datalen > 0)
7176 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7178 _res_constr.data = NULL;
7179 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7180 for (size_t m = 0; m < _res_constr.datalen; m++) {
7181 int64_t _res_conv_12 = _res_vals[m];
7182 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7183 FREE((void*)_res_conv_12);
7184 _res_constr.data[m] = _res_conv_12_conv;
7186 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7187 CVec_NetAddressZ_free(_res_constr);
7190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7191 LDKNodeAnnouncementInfo o_conv;
7192 o_conv.inner = (void*)(o & (~1));
7193 o_conv.is_owned = (o & 1) || (o == 0);
7194 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7195 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7196 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7197 return (long)ret_conv;
7200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7201 LDKDecodeError e_conv;
7202 e_conv.inner = (void*)(e & (~1));
7203 e_conv.is_owned = (e & 1) || (e == 0);
7204 e_conv = DecodeError_clone(&e_conv);
7205 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7206 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7207 return (long)ret_conv;
7210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7211 if ((_res & 1) != 0) return;
7212 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7214 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7218 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7219 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7220 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7221 return (long)ret_conv;
7224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7225 LDKCVec_u64Z _res_constr;
7226 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7227 if (_res_constr.datalen > 0)
7228 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7230 _res_constr.data = NULL;
7231 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7232 for (size_t g = 0; g < _res_constr.datalen; g++) {
7233 int64_t _res_conv_6 = _res_vals[g];
7234 _res_constr.data[g] = _res_conv_6;
7236 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7237 CVec_u64Z_free(_res_constr);
7240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7242 o_conv.inner = (void*)(o & (~1));
7243 o_conv.is_owned = (o & 1) || (o == 0);
7244 o_conv = NodeInfo_clone(&o_conv);
7245 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7246 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7247 return (long)ret_conv;
7250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7251 LDKDecodeError e_conv;
7252 e_conv.inner = (void*)(e & (~1));
7253 e_conv.is_owned = (e & 1) || (e == 0);
7254 e_conv = DecodeError_clone(&e_conv);
7255 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7256 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7257 return (long)ret_conv;
7260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7261 if ((_res & 1) != 0) return;
7262 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7264 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7268 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7269 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7270 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7271 return (long)ret_conv;
7274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7275 LDKNetworkGraph o_conv;
7276 o_conv.inner = (void*)(o & (~1));
7277 o_conv.is_owned = (o & 1) || (o == 0);
7278 o_conv = NetworkGraph_clone(&o_conv);
7279 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7280 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7281 return (long)ret_conv;
7284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7285 LDKDecodeError e_conv;
7286 e_conv.inner = (void*)(e & (~1));
7287 e_conv.is_owned = (e & 1) || (e == 0);
7288 e_conv = DecodeError_clone(&e_conv);
7289 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7290 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7291 return (long)ret_conv;
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7295 if ((_res & 1) != 0) return;
7296 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7298 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7302 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7303 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7304 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7305 return (long)ret_conv;
7308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7309 LDKTransaction b_ref;
7310 b_ref.datalen = (*env)->GetArrayLength(env, b);
7311 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7312 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7313 b_ref.data_is_owned = true;
7314 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7315 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7316 return (long)ret_ref;
7319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7320 if ((_res & 1) != 0) return;
7321 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7323 C2Tuple_usizeTransactionZ_free(_res_conv);
7326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7327 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7328 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7329 if (_res_constr.datalen > 0)
7330 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7332 _res_constr.data = NULL;
7333 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7334 for (size_t y = 0; y < _res_constr.datalen; y++) {
7335 int64_t _res_conv_24 = _res_vals[y];
7336 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
7337 FREE((void*)_res_conv_24);
7338 _res_constr.data[y] = _res_conv_24_conv;
7340 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7341 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
7345 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7346 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7347 return (long)ret_conv;
7350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
7351 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
7352 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7353 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7354 return (long)ret_conv;
7357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7358 if ((_res & 1) != 0) return;
7359 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7361 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7365 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7366 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7367 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7368 return (long)ret_conv;
7371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7372 LDKCVec_MonitorEventZ _res_constr;
7373 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7374 if (_res_constr.datalen > 0)
7375 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7377 _res_constr.data = NULL;
7378 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7379 for (size_t o = 0; o < _res_constr.datalen; o++) {
7380 int64_t _res_conv_14 = _res_vals[o];
7381 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7382 FREE((void*)_res_conv_14);
7383 _res_constr.data[o] = _res_conv_14_conv;
7385 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7386 CVec_MonitorEventZ_free(_res_constr);
7389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7390 LDKCVec_EventZ _res_constr;
7391 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7392 if (_res_constr.datalen > 0)
7393 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
7395 _res_constr.data = NULL;
7396 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7397 for (size_t h = 0; h < _res_constr.datalen; h++) {
7398 int64_t _res_conv_7 = _res_vals[h];
7399 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
7400 FREE((void*)_res_conv_7);
7401 _res_constr.data[h] = _res_conv_7_conv;
7403 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7404 CVec_EventZ_free(_res_constr);
7407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7409 o_conv.inner = (void*)(o & (~1));
7410 o_conv.is_owned = (o & 1) || (o == 0);
7411 o_conv = OutPoint_clone(&o_conv);
7412 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7413 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
7414 return (long)ret_conv;
7417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7418 LDKDecodeError e_conv;
7419 e_conv.inner = (void*)(e & (~1));
7420 e_conv.is_owned = (e & 1) || (e == 0);
7421 e_conv = DecodeError_clone(&e_conv);
7422 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7423 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
7424 return (long)ret_conv;
7427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7428 if ((_res & 1) != 0) return;
7429 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
7431 CResult_OutPointDecodeErrorZ_free(_res_conv);
7434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7435 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
7436 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7437 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
7438 return (long)ret_conv;
7441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7442 LDKChannelMonitorUpdate o_conv;
7443 o_conv.inner = (void*)(o & (~1));
7444 o_conv.is_owned = (o & 1) || (o == 0);
7445 o_conv = ChannelMonitorUpdate_clone(&o_conv);
7446 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7447 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
7448 return (long)ret_conv;
7451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7452 LDKDecodeError e_conv;
7453 e_conv.inner = (void*)(e & (~1));
7454 e_conv.is_owned = (e & 1) || (e == 0);
7455 e_conv = DecodeError_clone(&e_conv);
7456 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7457 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
7458 return (long)ret_conv;
7461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7462 if ((_res & 1) != 0) return;
7463 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7465 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
7468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7469 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
7470 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7471 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
7472 return (long)ret_conv;
7475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7476 LDKHTLCUpdate o_conv;
7477 o_conv.inner = (void*)(o & (~1));
7478 o_conv.is_owned = (o & 1) || (o == 0);
7479 o_conv = HTLCUpdate_clone(&o_conv);
7480 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7481 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
7482 return (long)ret_conv;
7485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7486 LDKDecodeError e_conv;
7487 e_conv.inner = (void*)(e & (~1));
7488 e_conv.is_owned = (e & 1) || (e == 0);
7489 e_conv = DecodeError_clone(&e_conv);
7490 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7491 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
7492 return (long)ret_conv;
7495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7496 if ((_res & 1) != 0) return;
7497 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7499 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
7502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7503 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
7504 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7505 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
7506 return (long)ret_conv;
7509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
7510 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7511 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
7512 return (long)ret_conv;
7515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7516 LDKMonitorUpdateError e_conv;
7517 e_conv.inner = (void*)(e & (~1));
7518 e_conv.is_owned = (e & 1) || (e == 0);
7519 e_conv = MonitorUpdateError_clone(&e_conv);
7520 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7521 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
7522 return (long)ret_conv;
7525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7526 if ((_res & 1) != 0) return;
7527 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
7529 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
7532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7533 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
7534 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7535 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
7536 return (long)ret_conv;
7539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7540 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
7541 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7542 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
7543 return (long)ret_ref;
7546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7548 a_conv.inner = (void*)(a & (~1));
7549 a_conv.is_owned = (a & 1) || (a == 0);
7550 a_conv = OutPoint_clone(&a_conv);
7552 b_ref.datalen = (*env)->GetArrayLength(env, b);
7553 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7554 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7555 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7556 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
7557 return (long)ret_ref;
7560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7561 if ((_res & 1) != 0) return;
7562 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
7564 C2Tuple_OutPointScriptZ_free(_res_conv);
7567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7568 LDKCVec_TransactionZ _res_constr;
7569 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7570 if (_res_constr.datalen > 0)
7571 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7573 _res_constr.data = NULL;
7574 for (size_t i = 0; i < _res_constr.datalen; i++) {
7575 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7576 LDKTransaction _res_conv_8_ref;
7577 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
7578 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
7579 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
7580 _res_conv_8_ref.data_is_owned = true;
7581 _res_constr.data[i] = _res_conv_8_ref;
7583 CVec_TransactionZ_free(_res_constr);
7586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7587 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
7588 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7589 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
7590 return (long)ret_ref;
7593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
7594 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
7596 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7597 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
7598 return (long)ret_ref;
7601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7602 if ((_res & 1) != 0) return;
7603 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
7605 C2Tuple_u32TxOutZ_free(_res_conv);
7608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7609 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
7610 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7611 if (_res_constr.datalen > 0)
7612 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7614 _res_constr.data = NULL;
7615 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7616 for (size_t a = 0; a < _res_constr.datalen; a++) {
7617 int64_t _res_conv_26 = _res_vals[a];
7618 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
7619 FREE((void*)_res_conv_26);
7620 _res_constr.data[a] = _res_conv_26_conv;
7622 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7623 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
7626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7627 LDKThirtyTwoBytes a_ref;
7628 CHECK((*env)->GetArrayLength(env, a) == 32);
7629 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7630 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
7631 b_constr.datalen = (*env)->GetArrayLength(env, b);
7632 if (b_constr.datalen > 0)
7633 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7635 b_constr.data = NULL;
7636 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7637 for (size_t a = 0; a < b_constr.datalen; a++) {
7638 int64_t b_conv_26 = b_vals[a];
7639 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
7640 FREE((void*)b_conv_26);
7641 b_constr.data[a] = b_conv_26_conv;
7643 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7644 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7645 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
7646 return (long)ret_ref;
7649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7650 if ((_res & 1) != 0) return;
7651 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
7653 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
7656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7657 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
7658 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7659 if (_res_constr.datalen > 0)
7660 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
7662 _res_constr.data = NULL;
7663 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7664 for (size_t u = 0; u < _res_constr.datalen; u++) {
7665 int64_t _res_conv_46 = _res_vals[u];
7666 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
7667 FREE((void*)_res_conv_46);
7668 _res_constr.data[u] = _res_conv_46_conv;
7670 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7671 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
7674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7675 LDKThirtyTwoBytes a_ref;
7676 CHECK((*env)->GetArrayLength(env, a) == 32);
7677 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7678 LDKChannelMonitor b_conv;
7679 b_conv.inner = (void*)(b & (~1));
7680 b_conv.is_owned = (b & 1) || (b == 0);
7681 b_conv = ChannelMonitor_clone(&b_conv);
7682 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7683 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7684 return (long)ret_ref;
7687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7688 if ((_res & 1) != 0) return;
7689 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7691 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7695 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
7697 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7698 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
7699 return (long)ret_conv;
7702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7703 LDKDecodeError e_conv;
7704 e_conv.inner = (void*)(e & (~1));
7705 e_conv.is_owned = (e & 1) || (e == 0);
7706 e_conv = DecodeError_clone(&e_conv);
7707 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7708 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
7709 return (long)ret_conv;
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7713 if ((_res & 1) != 0) return;
7714 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7716 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
7719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7720 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7721 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7722 if (_res_constr.datalen > 0)
7723 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7725 _res_constr.data = NULL;
7726 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7727 for (size_t b = 0; b < _res_constr.datalen; b++) {
7728 int64_t _res_conv_27 = _res_vals[b];
7729 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7730 FREE((void*)_res_conv_27);
7731 _res_constr.data[b] = _res_conv_27_conv;
7733 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7734 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7738 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7740 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7741 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7742 return (long)ret_conv;
7745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7746 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
7747 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7748 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7749 return (long)ret_conv;
7752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7753 if ((_res & 1) != 0) return;
7754 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7756 CResult_TxOutAccessErrorZ_free(_res_conv);
7759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7760 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7761 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7762 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7763 return (long)ret_conv;
7766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
7767 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7768 *ret_conv = CResult_NoneAPIErrorZ_ok();
7769 return (long)ret_conv;
7772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7773 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
7775 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7776 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
7777 return (long)ret_conv;
7780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7781 if ((_res & 1) != 0) return;
7782 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
7784 CResult_NoneAPIErrorZ_free(_res_conv);
7787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7788 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
7789 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7790 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
7791 return (long)ret_conv;
7794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7795 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
7796 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7797 if (_res_constr.datalen > 0)
7798 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
7800 _res_constr.data = NULL;
7801 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7802 for (size_t w = 0; w < _res_constr.datalen; w++) {
7803 int64_t _res_conv_22 = _res_vals[w];
7804 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
7805 FREE((void*)_res_conv_22);
7806 _res_constr.data[w] = _res_conv_22_conv;
7808 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7809 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
7812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7813 LDKCVec_APIErrorZ _res_constr;
7814 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7815 if (_res_constr.datalen > 0)
7816 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
7818 _res_constr.data = NULL;
7819 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7820 for (size_t k = 0; k < _res_constr.datalen; k++) {
7821 int64_t _res_conv_10 = _res_vals[k];
7822 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
7823 FREE((void*)_res_conv_10);
7824 _res_constr.data[k] = _res_conv_10_conv;
7826 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7827 CVec_APIErrorZ_free(_res_constr);
7830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7831 LDKCVec_ChannelDetailsZ _res_constr;
7832 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7833 if (_res_constr.datalen > 0)
7834 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7836 _res_constr.data = NULL;
7837 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7838 for (size_t q = 0; q < _res_constr.datalen; q++) {
7839 int64_t _res_conv_16 = _res_vals[q];
7840 LDKChannelDetails _res_conv_16_conv;
7841 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7842 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7843 _res_constr.data[q] = _res_conv_16_conv;
7845 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7846 CVec_ChannelDetailsZ_free(_res_constr);
7849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
7850 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7851 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
7852 return (long)ret_conv;
7855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7856 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
7858 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7859 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
7860 return (long)ret_conv;
7863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7864 if ((_res & 1) != 0) return;
7865 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
7867 CResult_NonePaymentSendFailureZ_free(_res_conv);
7870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7871 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
7872 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7873 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
7874 return (long)ret_conv;
7877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7878 LDKCVec_ChannelMonitorZ _res_constr;
7879 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7880 if (_res_constr.datalen > 0)
7881 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7883 _res_constr.data = NULL;
7884 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7885 for (size_t q = 0; q < _res_constr.datalen; q++) {
7886 int64_t _res_conv_16 = _res_vals[q];
7887 LDKChannelMonitor _res_conv_16_conv;
7888 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7889 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7890 _res_constr.data[q] = _res_conv_16_conv;
7892 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7893 CVec_ChannelMonitorZ_free(_res_constr);
7896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7897 LDKThirtyTwoBytes a_ref;
7898 CHECK((*env)->GetArrayLength(env, a) == 32);
7899 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7900 LDKChannelManager b_conv;
7901 b_conv.inner = (void*)(b & (~1));
7902 b_conv.is_owned = (b & 1) || (b == 0);
7903 // Warning: we need a move here but no clone is available for LDKChannelManager
7904 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
7905 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
7906 return (long)ret_ref;
7909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7910 if ((_res & 1) != 0) return;
7911 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
7913 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
7916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7917 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
7919 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7920 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
7921 return (long)ret_conv;
7924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7925 LDKDecodeError e_conv;
7926 e_conv.inner = (void*)(e & (~1));
7927 e_conv.is_owned = (e & 1) || (e == 0);
7928 e_conv = DecodeError_clone(&e_conv);
7929 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7930 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
7931 return (long)ret_conv;
7934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7935 if ((_res & 1) != 0) return;
7936 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7938 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
7941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7942 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7944 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7945 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7946 return (long)ret_conv;
7949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7950 LDKDecodeError e_conv;
7951 e_conv.inner = (void*)(e & (~1));
7952 e_conv.is_owned = (e & 1) || (e == 0);
7953 e_conv = DecodeError_clone(&e_conv);
7954 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7955 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7956 return (long)ret_conv;
7959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7960 if ((_res & 1) != 0) return;
7961 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7963 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7967 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7968 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7969 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7970 return (long)ret_conv;
7973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7974 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7975 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7976 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7977 return (long)ret_ref;
7980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
7982 CHECK((*env)->GetArrayLength(env, a) == 64);
7983 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
7984 LDKCVec_SignatureZ b_constr;
7985 b_constr.datalen = (*env)->GetArrayLength(env, b);
7986 if (b_constr.datalen > 0)
7987 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7989 b_constr.data = NULL;
7990 for (size_t i = 0; i < b_constr.datalen; i++) {
7991 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
7992 LDKSignature b_conv_8_ref;
7993 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
7994 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
7995 b_constr.data[i] = b_conv_8_ref;
7997 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7998 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7999 return (long)ret_ref;
8002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8003 if ((_res & 1) != 0) return;
8004 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8006 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8010 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8012 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8013 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8014 return (long)ret_conv;
8017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
8018 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8019 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8020 return (long)ret_conv;
8023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8024 if ((_res & 1) != 0) return;
8025 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8027 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8031 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8032 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8033 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8034 return (long)ret_conv;
8037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8039 CHECK((*env)->GetArrayLength(env, o) == 64);
8040 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
8041 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8042 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8043 return (long)ret_conv;
8046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
8047 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8048 *ret_conv = CResult_SignatureNoneZ_err();
8049 return (long)ret_conv;
8052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8053 if ((_res & 1) != 0) return;
8054 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8056 CResult_SignatureNoneZ_free(_res_conv);
8059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8060 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8061 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8062 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8063 return (long)ret_conv;
8066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8067 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8068 if (o_conv.free == LDKSign_JCalls_free) {
8069 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8070 LDKSign_JCalls_clone(o_conv.this_arg);
8072 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8073 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8074 return (long)ret_conv;
8077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8078 LDKDecodeError e_conv;
8079 e_conv.inner = (void*)(e & (~1));
8080 e_conv.is_owned = (e & 1) || (e == 0);
8081 e_conv = DecodeError_clone(&e_conv);
8082 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8083 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8084 return (long)ret_conv;
8087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8088 if ((_res & 1) != 0) return;
8089 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8091 CResult_SignDecodeErrorZ_free(_res_conv);
8094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8095 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8096 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8097 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8098 return (long)ret_conv;
8101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8102 LDKCVec_CVec_u8ZZ _res_constr;
8103 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8104 if (_res_constr.datalen > 0)
8105 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8107 _res_constr.data = NULL;
8108 for (size_t i = 0; i < _res_constr.datalen; i++) {
8109 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8110 LDKCVec_u8Z _res_conv_8_ref;
8111 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
8112 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8113 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
8114 _res_constr.data[i] = _res_conv_8_ref;
8116 CVec_CVec_u8ZZ_free(_res_constr);
8119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
8120 LDKCVec_CVec_u8ZZ o_constr;
8121 o_constr.datalen = (*env)->GetArrayLength(env, o);
8122 if (o_constr.datalen > 0)
8123 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8125 o_constr.data = NULL;
8126 for (size_t i = 0; i < o_constr.datalen; i++) {
8127 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
8128 LDKCVec_u8Z o_conv_8_ref;
8129 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
8130 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8131 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
8132 o_constr.data[i] = o_conv_8_ref;
8134 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8135 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8136 return (long)ret_conv;
8139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
8140 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8141 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8142 return (long)ret_conv;
8145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8146 if ((_res & 1) != 0) return;
8147 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8149 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8153 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8154 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8155 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8156 return (long)ret_conv;
8159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8160 LDKInMemorySigner o_conv;
8161 o_conv.inner = (void*)(o & (~1));
8162 o_conv.is_owned = (o & 1) || (o == 0);
8163 o_conv = InMemorySigner_clone(&o_conv);
8164 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8165 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8166 return (long)ret_conv;
8169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8170 LDKDecodeError e_conv;
8171 e_conv.inner = (void*)(e & (~1));
8172 e_conv.is_owned = (e & 1) || (e == 0);
8173 e_conv = DecodeError_clone(&e_conv);
8174 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8175 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8176 return (long)ret_conv;
8179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8180 if ((_res & 1) != 0) return;
8181 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8183 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8187 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8188 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8189 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8190 return (long)ret_conv;
8193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8194 LDKCVec_TxOutZ _res_constr;
8195 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8196 if (_res_constr.datalen > 0)
8197 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8199 _res_constr.data = NULL;
8200 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8201 for (size_t h = 0; h < _res_constr.datalen; h++) {
8202 int64_t _res_conv_7 = _res_vals[h];
8203 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8204 FREE((void*)_res_conv_7);
8205 _res_constr.data[h] = _res_conv_7_conv;
8207 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8208 CVec_TxOutZ_free(_res_constr);
8211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8212 LDKTransaction o_ref;
8213 o_ref.datalen = (*env)->GetArrayLength(env, o);
8214 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8215 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
8216 o_ref.data_is_owned = true;
8217 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8218 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8219 return (long)ret_conv;
8222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
8223 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8224 *ret_conv = CResult_TransactionNoneZ_err();
8225 return (long)ret_conv;
8228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8229 if ((_res & 1) != 0) return;
8230 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8232 CResult_TransactionNoneZ_free(_res_conv);
8235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8236 LDKCVec_RouteHopZ _res_constr;
8237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8238 if (_res_constr.datalen > 0)
8239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8241 _res_constr.data = NULL;
8242 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8243 for (size_t k = 0; k < _res_constr.datalen; k++) {
8244 int64_t _res_conv_10 = _res_vals[k];
8245 LDKRouteHop _res_conv_10_conv;
8246 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8247 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8248 _res_constr.data[k] = _res_conv_10_conv;
8250 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8251 CVec_RouteHopZ_free(_res_constr);
8254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8255 LDKCVec_CVec_RouteHopZZ _res_constr;
8256 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8257 if (_res_constr.datalen > 0)
8258 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8260 _res_constr.data = NULL;
8261 for (size_t m = 0; m < _res_constr.datalen; m++) {
8262 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
8263 LDKCVec_RouteHopZ _res_conv_12_constr;
8264 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
8265 if (_res_conv_12_constr.datalen > 0)
8266 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8268 _res_conv_12_constr.data = NULL;
8269 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
8270 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8271 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8272 LDKRouteHop _res_conv_12_conv_10_conv;
8273 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8274 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8275 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8277 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
8278 _res_constr.data[m] = _res_conv_12_constr;
8280 CVec_CVec_RouteHopZZ_free(_res_constr);
8283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8285 o_conv.inner = (void*)(o & (~1));
8286 o_conv.is_owned = (o & 1) || (o == 0);
8287 o_conv = Route_clone(&o_conv);
8288 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8289 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8290 return (long)ret_conv;
8293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8294 LDKDecodeError e_conv;
8295 e_conv.inner = (void*)(e & (~1));
8296 e_conv.is_owned = (e & 1) || (e == 0);
8297 e_conv = DecodeError_clone(&e_conv);
8298 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8299 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8300 return (long)ret_conv;
8303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8304 if ((_res & 1) != 0) return;
8305 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
8307 CResult_RouteDecodeErrorZ_free(_res_conv);
8310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8311 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8312 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8313 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8314 return (long)ret_conv;
8317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8318 LDKCVec_RouteHintZ _res_constr;
8319 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8320 if (_res_constr.datalen > 0)
8321 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8323 _res_constr.data = NULL;
8324 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8325 for (size_t l = 0; l < _res_constr.datalen; l++) {
8326 int64_t _res_conv_11 = _res_vals[l];
8327 LDKRouteHint _res_conv_11_conv;
8328 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8329 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8330 _res_constr.data[l] = _res_conv_11_conv;
8332 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8333 CVec_RouteHintZ_free(_res_constr);
8336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8338 o_conv.inner = (void*)(o & (~1));
8339 o_conv.is_owned = (o & 1) || (o == 0);
8340 o_conv = Route_clone(&o_conv);
8341 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8342 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8343 return (long)ret_conv;
8346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8347 LDKLightningError e_conv;
8348 e_conv.inner = (void*)(e & (~1));
8349 e_conv.is_owned = (e & 1) || (e == 0);
8350 e_conv = LightningError_clone(&e_conv);
8351 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8352 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8353 return (long)ret_conv;
8356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8357 if ((_res & 1) != 0) return;
8358 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8360 CResult_RouteLightningErrorZ_free(_res_conv);
8363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8364 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8365 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8366 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8367 return (long)ret_conv;
8370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
8371 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
8373 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8374 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
8375 return (long)ret_conv;
8378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
8379 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8380 *ret_conv = CResult_NetAddressu8Z_err(e);
8381 return (long)ret_conv;
8384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8385 if ((_res & 1) != 0) return;
8386 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
8388 CResult_NetAddressu8Z_free(_res_conv);
8391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8392 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
8393 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8394 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
8395 return (long)ret_conv;
8398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8399 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
8401 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8402 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
8403 return (long)ret_conv;
8406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8407 LDKDecodeError e_conv;
8408 e_conv.inner = (void*)(e & (~1));
8409 e_conv.is_owned = (e & 1) || (e == 0);
8410 e_conv = DecodeError_clone(&e_conv);
8411 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8412 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
8413 return (long)ret_conv;
8416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8417 if ((_res & 1) != 0) return;
8418 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8420 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
8423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8424 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
8425 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8426 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
8427 return (long)ret_conv;
8430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8431 LDKCVec_UpdateAddHTLCZ _res_constr;
8432 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8433 if (_res_constr.datalen > 0)
8434 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
8436 _res_constr.data = NULL;
8437 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8438 for (size_t p = 0; p < _res_constr.datalen; p++) {
8439 int64_t _res_conv_15 = _res_vals[p];
8440 LDKUpdateAddHTLC _res_conv_15_conv;
8441 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
8442 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
8443 _res_constr.data[p] = _res_conv_15_conv;
8445 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8446 CVec_UpdateAddHTLCZ_free(_res_constr);
8449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8450 LDKCVec_UpdateFulfillHTLCZ _res_constr;
8451 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8452 if (_res_constr.datalen > 0)
8453 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
8455 _res_constr.data = NULL;
8456 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8457 for (size_t t = 0; t < _res_constr.datalen; t++) {
8458 int64_t _res_conv_19 = _res_vals[t];
8459 LDKUpdateFulfillHTLC _res_conv_19_conv;
8460 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
8461 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
8462 _res_constr.data[t] = _res_conv_19_conv;
8464 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8465 CVec_UpdateFulfillHTLCZ_free(_res_constr);
8468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8469 LDKCVec_UpdateFailHTLCZ _res_constr;
8470 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8471 if (_res_constr.datalen > 0)
8472 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
8474 _res_constr.data = NULL;
8475 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8476 for (size_t q = 0; q < _res_constr.datalen; q++) {
8477 int64_t _res_conv_16 = _res_vals[q];
8478 LDKUpdateFailHTLC _res_conv_16_conv;
8479 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8480 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8481 _res_constr.data[q] = _res_conv_16_conv;
8483 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8484 CVec_UpdateFailHTLCZ_free(_res_constr);
8487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8488 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
8489 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8490 if (_res_constr.datalen > 0)
8491 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
8493 _res_constr.data = NULL;
8494 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8495 for (size_t z = 0; z < _res_constr.datalen; z++) {
8496 int64_t _res_conv_25 = _res_vals[z];
8497 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
8498 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
8499 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
8500 _res_constr.data[z] = _res_conv_25_conv;
8502 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8503 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
8506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8507 LDKAcceptChannel o_conv;
8508 o_conv.inner = (void*)(o & (~1));
8509 o_conv.is_owned = (o & 1) || (o == 0);
8510 o_conv = AcceptChannel_clone(&o_conv);
8511 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8512 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
8513 return (long)ret_conv;
8516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8517 LDKDecodeError e_conv;
8518 e_conv.inner = (void*)(e & (~1));
8519 e_conv.is_owned = (e & 1) || (e == 0);
8520 e_conv = DecodeError_clone(&e_conv);
8521 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8522 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
8523 return (long)ret_conv;
8526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8527 if ((_res & 1) != 0) return;
8528 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8530 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
8533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8534 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
8535 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8536 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
8537 return (long)ret_conv;
8540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8541 LDKAnnouncementSignatures o_conv;
8542 o_conv.inner = (void*)(o & (~1));
8543 o_conv.is_owned = (o & 1) || (o == 0);
8544 o_conv = AnnouncementSignatures_clone(&o_conv);
8545 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8546 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
8547 return (long)ret_conv;
8550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8551 LDKDecodeError e_conv;
8552 e_conv.inner = (void*)(e & (~1));
8553 e_conv.is_owned = (e & 1) || (e == 0);
8554 e_conv = DecodeError_clone(&e_conv);
8555 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8556 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
8557 return (long)ret_conv;
8560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8561 if ((_res & 1) != 0) return;
8562 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8564 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
8567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8568 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
8569 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8570 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
8571 return (long)ret_conv;
8574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8575 LDKChannelReestablish o_conv;
8576 o_conv.inner = (void*)(o & (~1));
8577 o_conv.is_owned = (o & 1) || (o == 0);
8578 o_conv = ChannelReestablish_clone(&o_conv);
8579 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8580 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
8581 return (long)ret_conv;
8584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8585 LDKDecodeError e_conv;
8586 e_conv.inner = (void*)(e & (~1));
8587 e_conv.is_owned = (e & 1) || (e == 0);
8588 e_conv = DecodeError_clone(&e_conv);
8589 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8590 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
8591 return (long)ret_conv;
8594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8595 if ((_res & 1) != 0) return;
8596 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
8598 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
8601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8602 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
8603 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8604 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
8605 return (long)ret_conv;
8608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8609 LDKClosingSigned o_conv;
8610 o_conv.inner = (void*)(o & (~1));
8611 o_conv.is_owned = (o & 1) || (o == 0);
8612 o_conv = ClosingSigned_clone(&o_conv);
8613 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8614 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
8615 return (long)ret_conv;
8618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8619 LDKDecodeError e_conv;
8620 e_conv.inner = (void*)(e & (~1));
8621 e_conv.is_owned = (e & 1) || (e == 0);
8622 e_conv = DecodeError_clone(&e_conv);
8623 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8624 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
8625 return (long)ret_conv;
8628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8629 if ((_res & 1) != 0) return;
8630 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8632 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
8635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8636 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
8637 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8638 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
8639 return (long)ret_conv;
8642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8643 LDKCommitmentSigned o_conv;
8644 o_conv.inner = (void*)(o & (~1));
8645 o_conv.is_owned = (o & 1) || (o == 0);
8646 o_conv = CommitmentSigned_clone(&o_conv);
8647 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8648 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
8649 return (long)ret_conv;
8652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8653 LDKDecodeError e_conv;
8654 e_conv.inner = (void*)(e & (~1));
8655 e_conv.is_owned = (e & 1) || (e == 0);
8656 e_conv = DecodeError_clone(&e_conv);
8657 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8658 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
8659 return (long)ret_conv;
8662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8663 if ((_res & 1) != 0) return;
8664 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8666 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
8669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8670 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
8671 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8672 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
8673 return (long)ret_conv;
8676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8677 LDKFundingCreated o_conv;
8678 o_conv.inner = (void*)(o & (~1));
8679 o_conv.is_owned = (o & 1) || (o == 0);
8680 o_conv = FundingCreated_clone(&o_conv);
8681 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8682 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
8683 return (long)ret_conv;
8686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8687 LDKDecodeError e_conv;
8688 e_conv.inner = (void*)(e & (~1));
8689 e_conv.is_owned = (e & 1) || (e == 0);
8690 e_conv = DecodeError_clone(&e_conv);
8691 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8692 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
8693 return (long)ret_conv;
8696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8697 if ((_res & 1) != 0) return;
8698 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8700 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
8703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8704 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
8705 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8706 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
8707 return (long)ret_conv;
8710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8711 LDKFundingSigned o_conv;
8712 o_conv.inner = (void*)(o & (~1));
8713 o_conv.is_owned = (o & 1) || (o == 0);
8714 o_conv = FundingSigned_clone(&o_conv);
8715 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8716 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
8717 return (long)ret_conv;
8720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8721 LDKDecodeError e_conv;
8722 e_conv.inner = (void*)(e & (~1));
8723 e_conv.is_owned = (e & 1) || (e == 0);
8724 e_conv = DecodeError_clone(&e_conv);
8725 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8726 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
8727 return (long)ret_conv;
8730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8731 if ((_res & 1) != 0) return;
8732 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8734 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
8737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8738 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
8739 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8740 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
8741 return (long)ret_conv;
8744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8745 LDKFundingLocked o_conv;
8746 o_conv.inner = (void*)(o & (~1));
8747 o_conv.is_owned = (o & 1) || (o == 0);
8748 o_conv = FundingLocked_clone(&o_conv);
8749 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8750 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
8751 return (long)ret_conv;
8754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8755 LDKDecodeError e_conv;
8756 e_conv.inner = (void*)(e & (~1));
8757 e_conv.is_owned = (e & 1) || (e == 0);
8758 e_conv = DecodeError_clone(&e_conv);
8759 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8760 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
8761 return (long)ret_conv;
8764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8765 if ((_res & 1) != 0) return;
8766 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8768 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
8771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8772 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
8773 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8774 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
8775 return (long)ret_conv;
8778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8780 o_conv.inner = (void*)(o & (~1));
8781 o_conv.is_owned = (o & 1) || (o == 0);
8782 o_conv = Init_clone(&o_conv);
8783 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8784 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
8785 return (long)ret_conv;
8788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8789 LDKDecodeError e_conv;
8790 e_conv.inner = (void*)(e & (~1));
8791 e_conv.is_owned = (e & 1) || (e == 0);
8792 e_conv = DecodeError_clone(&e_conv);
8793 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8794 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
8795 return (long)ret_conv;
8798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8799 if ((_res & 1) != 0) return;
8800 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
8802 CResult_InitDecodeErrorZ_free(_res_conv);
8805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8806 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
8807 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8808 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
8809 return (long)ret_conv;
8812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8813 LDKOpenChannel o_conv;
8814 o_conv.inner = (void*)(o & (~1));
8815 o_conv.is_owned = (o & 1) || (o == 0);
8816 o_conv = OpenChannel_clone(&o_conv);
8817 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8818 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
8819 return (long)ret_conv;
8822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8823 LDKDecodeError e_conv;
8824 e_conv.inner = (void*)(e & (~1));
8825 e_conv.is_owned = (e & 1) || (e == 0);
8826 e_conv = DecodeError_clone(&e_conv);
8827 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8828 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
8829 return (long)ret_conv;
8832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8833 if ((_res & 1) != 0) return;
8834 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8836 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
8839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8840 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
8841 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8842 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
8843 return (long)ret_conv;
8846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8847 LDKRevokeAndACK o_conv;
8848 o_conv.inner = (void*)(o & (~1));
8849 o_conv.is_owned = (o & 1) || (o == 0);
8850 o_conv = RevokeAndACK_clone(&o_conv);
8851 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8852 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
8853 return (long)ret_conv;
8856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8857 LDKDecodeError e_conv;
8858 e_conv.inner = (void*)(e & (~1));
8859 e_conv.is_owned = (e & 1) || (e == 0);
8860 e_conv = DecodeError_clone(&e_conv);
8861 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8862 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
8863 return (long)ret_conv;
8866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8867 if ((_res & 1) != 0) return;
8868 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
8870 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
8873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8874 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
8875 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8876 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
8877 return (long)ret_conv;
8880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8882 o_conv.inner = (void*)(o & (~1));
8883 o_conv.is_owned = (o & 1) || (o == 0);
8884 o_conv = Shutdown_clone(&o_conv);
8885 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8886 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
8887 return (long)ret_conv;
8890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8891 LDKDecodeError e_conv;
8892 e_conv.inner = (void*)(e & (~1));
8893 e_conv.is_owned = (e & 1) || (e == 0);
8894 e_conv = DecodeError_clone(&e_conv);
8895 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8896 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
8897 return (long)ret_conv;
8900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8901 if ((_res & 1) != 0) return;
8902 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
8904 CResult_ShutdownDecodeErrorZ_free(_res_conv);
8907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8908 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
8909 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8910 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
8911 return (long)ret_conv;
8914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8915 LDKUpdateFailHTLC o_conv;
8916 o_conv.inner = (void*)(o & (~1));
8917 o_conv.is_owned = (o & 1) || (o == 0);
8918 o_conv = UpdateFailHTLC_clone(&o_conv);
8919 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8920 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
8921 return (long)ret_conv;
8924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8925 LDKDecodeError e_conv;
8926 e_conv.inner = (void*)(e & (~1));
8927 e_conv.is_owned = (e & 1) || (e == 0);
8928 e_conv = DecodeError_clone(&e_conv);
8929 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8930 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
8931 return (long)ret_conv;
8934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8935 if ((_res & 1) != 0) return;
8936 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8938 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
8941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8942 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
8943 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8944 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
8945 return (long)ret_conv;
8948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8949 LDKUpdateFailMalformedHTLC o_conv;
8950 o_conv.inner = (void*)(o & (~1));
8951 o_conv.is_owned = (o & 1) || (o == 0);
8952 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
8953 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8954 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
8955 return (long)ret_conv;
8958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8959 LDKDecodeError e_conv;
8960 e_conv.inner = (void*)(e & (~1));
8961 e_conv.is_owned = (e & 1) || (e == 0);
8962 e_conv = DecodeError_clone(&e_conv);
8963 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8964 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8965 return (long)ret_conv;
8968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8969 if ((_res & 1) != 0) return;
8970 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8972 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8976 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8977 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8978 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8979 return (long)ret_conv;
8982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8983 LDKUpdateFee o_conv;
8984 o_conv.inner = (void*)(o & (~1));
8985 o_conv.is_owned = (o & 1) || (o == 0);
8986 o_conv = UpdateFee_clone(&o_conv);
8987 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8988 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8989 return (long)ret_conv;
8992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8993 LDKDecodeError e_conv;
8994 e_conv.inner = (void*)(e & (~1));
8995 e_conv.is_owned = (e & 1) || (e == 0);
8996 e_conv = DecodeError_clone(&e_conv);
8997 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8998 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8999 return (long)ret_conv;
9002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9003 if ((_res & 1) != 0) return;
9004 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9006 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
9009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9010 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
9011 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9012 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
9013 return (long)ret_conv;
9016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9017 LDKUpdateFulfillHTLC o_conv;
9018 o_conv.inner = (void*)(o & (~1));
9019 o_conv.is_owned = (o & 1) || (o == 0);
9020 o_conv = UpdateFulfillHTLC_clone(&o_conv);
9021 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9022 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
9023 return (long)ret_conv;
9026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9027 LDKDecodeError e_conv;
9028 e_conv.inner = (void*)(e & (~1));
9029 e_conv.is_owned = (e & 1) || (e == 0);
9030 e_conv = DecodeError_clone(&e_conv);
9031 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9032 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
9033 return (long)ret_conv;
9036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9037 if ((_res & 1) != 0) return;
9038 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9040 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
9043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9044 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
9045 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9046 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
9047 return (long)ret_conv;
9050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9051 LDKUpdateAddHTLC o_conv;
9052 o_conv.inner = (void*)(o & (~1));
9053 o_conv.is_owned = (o & 1) || (o == 0);
9054 o_conv = UpdateAddHTLC_clone(&o_conv);
9055 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9056 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
9057 return (long)ret_conv;
9060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9061 LDKDecodeError e_conv;
9062 e_conv.inner = (void*)(e & (~1));
9063 e_conv.is_owned = (e & 1) || (e == 0);
9064 e_conv = DecodeError_clone(&e_conv);
9065 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9066 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
9067 return (long)ret_conv;
9070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9071 if ((_res & 1) != 0) return;
9072 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9074 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
9077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9078 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
9079 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9080 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
9081 return (long)ret_conv;
9084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9086 o_conv.inner = (void*)(o & (~1));
9087 o_conv.is_owned = (o & 1) || (o == 0);
9088 o_conv = Ping_clone(&o_conv);
9089 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9090 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
9091 return (long)ret_conv;
9094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9095 LDKDecodeError e_conv;
9096 e_conv.inner = (void*)(e & (~1));
9097 e_conv.is_owned = (e & 1) || (e == 0);
9098 e_conv = DecodeError_clone(&e_conv);
9099 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9100 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
9101 return (long)ret_conv;
9104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9105 if ((_res & 1) != 0) return;
9106 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
9108 CResult_PingDecodeErrorZ_free(_res_conv);
9111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9112 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
9113 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9114 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
9115 return (long)ret_conv;
9118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9120 o_conv.inner = (void*)(o & (~1));
9121 o_conv.is_owned = (o & 1) || (o == 0);
9122 o_conv = Pong_clone(&o_conv);
9123 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9124 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
9125 return (long)ret_conv;
9128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9129 LDKDecodeError e_conv;
9130 e_conv.inner = (void*)(e & (~1));
9131 e_conv.is_owned = (e & 1) || (e == 0);
9132 e_conv = DecodeError_clone(&e_conv);
9133 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9134 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
9135 return (long)ret_conv;
9138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9139 if ((_res & 1) != 0) return;
9140 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
9142 CResult_PongDecodeErrorZ_free(_res_conv);
9145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9146 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
9147 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9148 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
9149 return (long)ret_conv;
9152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9153 LDKUnsignedChannelAnnouncement o_conv;
9154 o_conv.inner = (void*)(o & (~1));
9155 o_conv.is_owned = (o & 1) || (o == 0);
9156 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
9157 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9158 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
9159 return (long)ret_conv;
9162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9163 LDKDecodeError e_conv;
9164 e_conv.inner = (void*)(e & (~1));
9165 e_conv.is_owned = (e & 1) || (e == 0);
9166 e_conv = DecodeError_clone(&e_conv);
9167 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9168 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
9169 return (long)ret_conv;
9172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9173 if ((_res & 1) != 0) return;
9174 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9176 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
9179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9180 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9181 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9182 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9183 return (long)ret_conv;
9186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9187 LDKChannelAnnouncement o_conv;
9188 o_conv.inner = (void*)(o & (~1));
9189 o_conv.is_owned = (o & 1) || (o == 0);
9190 o_conv = ChannelAnnouncement_clone(&o_conv);
9191 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9192 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
9193 return (long)ret_conv;
9196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9197 LDKDecodeError e_conv;
9198 e_conv.inner = (void*)(e & (~1));
9199 e_conv.is_owned = (e & 1) || (e == 0);
9200 e_conv = DecodeError_clone(&e_conv);
9201 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9202 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
9203 return (long)ret_conv;
9206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9207 if ((_res & 1) != 0) return;
9208 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9210 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
9213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9214 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9215 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9216 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9217 return (long)ret_conv;
9220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9221 LDKUnsignedChannelUpdate o_conv;
9222 o_conv.inner = (void*)(o & (~1));
9223 o_conv.is_owned = (o & 1) || (o == 0);
9224 o_conv = UnsignedChannelUpdate_clone(&o_conv);
9225 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9226 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
9227 return (long)ret_conv;
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9231 LDKDecodeError e_conv;
9232 e_conv.inner = (void*)(e & (~1));
9233 e_conv.is_owned = (e & 1) || (e == 0);
9234 e_conv = DecodeError_clone(&e_conv);
9235 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9236 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
9237 return (long)ret_conv;
9240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9241 if ((_res & 1) != 0) return;
9242 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9244 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9248 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
9249 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9250 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
9251 return (long)ret_conv;
9254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9255 LDKChannelUpdate o_conv;
9256 o_conv.inner = (void*)(o & (~1));
9257 o_conv.is_owned = (o & 1) || (o == 0);
9258 o_conv = ChannelUpdate_clone(&o_conv);
9259 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9260 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
9261 return (long)ret_conv;
9264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9265 LDKDecodeError e_conv;
9266 e_conv.inner = (void*)(e & (~1));
9267 e_conv.is_owned = (e & 1) || (e == 0);
9268 e_conv = DecodeError_clone(&e_conv);
9269 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9270 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
9271 return (long)ret_conv;
9274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9275 if ((_res & 1) != 0) return;
9276 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9278 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
9281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9282 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
9283 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9284 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
9285 return (long)ret_conv;
9288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9289 LDKErrorMessage o_conv;
9290 o_conv.inner = (void*)(o & (~1));
9291 o_conv.is_owned = (o & 1) || (o == 0);
9292 o_conv = ErrorMessage_clone(&o_conv);
9293 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9294 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
9295 return (long)ret_conv;
9298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9299 LDKDecodeError e_conv;
9300 e_conv.inner = (void*)(e & (~1));
9301 e_conv.is_owned = (e & 1) || (e == 0);
9302 e_conv = DecodeError_clone(&e_conv);
9303 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9304 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
9305 return (long)ret_conv;
9308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9309 if ((_res & 1) != 0) return;
9310 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
9312 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
9315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9316 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
9317 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9318 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
9319 return (long)ret_conv;
9322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9323 LDKUnsignedNodeAnnouncement o_conv;
9324 o_conv.inner = (void*)(o & (~1));
9325 o_conv.is_owned = (o & 1) || (o == 0);
9326 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
9327 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9328 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
9329 return (long)ret_conv;
9332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9333 LDKDecodeError e_conv;
9334 e_conv.inner = (void*)(e & (~1));
9335 e_conv.is_owned = (e & 1) || (e == 0);
9336 e_conv = DecodeError_clone(&e_conv);
9337 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9338 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
9339 return (long)ret_conv;
9342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9343 if ((_res & 1) != 0) return;
9344 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9346 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
9349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9350 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
9351 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9352 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
9353 return (long)ret_conv;
9356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9357 LDKNodeAnnouncement o_conv;
9358 o_conv.inner = (void*)(o & (~1));
9359 o_conv.is_owned = (o & 1) || (o == 0);
9360 o_conv = NodeAnnouncement_clone(&o_conv);
9361 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9362 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
9363 return (long)ret_conv;
9366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9367 LDKDecodeError e_conv;
9368 e_conv.inner = (void*)(e & (~1));
9369 e_conv.is_owned = (e & 1) || (e == 0);
9370 e_conv = DecodeError_clone(&e_conv);
9371 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9372 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
9373 return (long)ret_conv;
9376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9377 if ((_res & 1) != 0) return;
9378 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9380 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
9383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9384 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
9385 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9386 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
9387 return (long)ret_conv;
9390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9391 LDKQueryShortChannelIds o_conv;
9392 o_conv.inner = (void*)(o & (~1));
9393 o_conv.is_owned = (o & 1) || (o == 0);
9394 o_conv = QueryShortChannelIds_clone(&o_conv);
9395 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9396 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
9397 return (long)ret_conv;
9400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9401 LDKDecodeError e_conv;
9402 e_conv.inner = (void*)(e & (~1));
9403 e_conv.is_owned = (e & 1) || (e == 0);
9404 e_conv = DecodeError_clone(&e_conv);
9405 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9406 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
9407 return (long)ret_conv;
9410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9411 if ((_res & 1) != 0) return;
9412 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
9414 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
9417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9418 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
9419 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9420 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
9421 return (long)ret_conv;
9424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9425 LDKReplyShortChannelIdsEnd o_conv;
9426 o_conv.inner = (void*)(o & (~1));
9427 o_conv.is_owned = (o & 1) || (o == 0);
9428 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
9429 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9430 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
9431 return (long)ret_conv;
9434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9435 LDKDecodeError e_conv;
9436 e_conv.inner = (void*)(e & (~1));
9437 e_conv.is_owned = (e & 1) || (e == 0);
9438 e_conv = DecodeError_clone(&e_conv);
9439 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9440 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
9441 return (long)ret_conv;
9444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9445 if ((_res & 1) != 0) return;
9446 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
9448 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
9451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9452 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
9453 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9454 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
9455 return (long)ret_conv;
9458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9459 LDKQueryChannelRange o_conv;
9460 o_conv.inner = (void*)(o & (~1));
9461 o_conv.is_owned = (o & 1) || (o == 0);
9462 o_conv = QueryChannelRange_clone(&o_conv);
9463 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9464 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
9465 return (long)ret_conv;
9468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9469 LDKDecodeError e_conv;
9470 e_conv.inner = (void*)(e & (~1));
9471 e_conv.is_owned = (e & 1) || (e == 0);
9472 e_conv = DecodeError_clone(&e_conv);
9473 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9474 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
9475 return (long)ret_conv;
9478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9479 if ((_res & 1) != 0) return;
9480 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9482 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
9485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9486 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
9487 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9488 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
9489 return (long)ret_conv;
9492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9493 LDKReplyChannelRange o_conv;
9494 o_conv.inner = (void*)(o & (~1));
9495 o_conv.is_owned = (o & 1) || (o == 0);
9496 o_conv = ReplyChannelRange_clone(&o_conv);
9497 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9498 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
9499 return (long)ret_conv;
9502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9503 LDKDecodeError e_conv;
9504 e_conv.inner = (void*)(e & (~1));
9505 e_conv.is_owned = (e & 1) || (e == 0);
9506 e_conv = DecodeError_clone(&e_conv);
9507 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9508 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
9509 return (long)ret_conv;
9512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9513 if ((_res & 1) != 0) return;
9514 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9516 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
9519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9520 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
9521 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9522 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
9523 return (long)ret_conv;
9526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9527 LDKGossipTimestampFilter o_conv;
9528 o_conv.inner = (void*)(o & (~1));
9529 o_conv.is_owned = (o & 1) || (o == 0);
9530 o_conv = GossipTimestampFilter_clone(&o_conv);
9531 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9532 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
9533 return (long)ret_conv;
9536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9537 LDKDecodeError e_conv;
9538 e_conv.inner = (void*)(e & (~1));
9539 e_conv.is_owned = (e & 1) || (e == 0);
9540 e_conv = DecodeError_clone(&e_conv);
9541 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9542 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
9543 return (long)ret_conv;
9546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9547 if ((_res & 1) != 0) return;
9548 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
9550 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
9553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9554 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
9555 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9556 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
9557 return (long)ret_conv;
9560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9561 if ((this_ptr & 1) != 0) return;
9562 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9563 FREE((void*)this_ptr);
9564 Event_free(this_ptr_conv);
9567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9568 LDKEvent* orig_conv = (LDKEvent*)orig;
9569 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9570 *ret_copy = Event_clone(orig_conv);
9571 long ret_ref = (long)ret_copy;
9575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
9576 LDKEvent* obj_conv = (LDKEvent*)obj;
9577 LDKCVec_u8Z ret_var = Event_write(obj_conv);
9578 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9579 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9580 CVec_u8Z_free(ret_var);
9584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9585 if ((this_ptr & 1) != 0) return;
9586 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9587 FREE((void*)this_ptr);
9588 MessageSendEvent_free(this_ptr_conv);
9591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9592 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9593 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9594 *ret_copy = MessageSendEvent_clone(orig_conv);
9595 long ret_ref = (long)ret_copy;
9599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9600 if ((this_ptr & 1) != 0) return;
9601 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9602 FREE((void*)this_ptr);
9603 MessageSendEventsProvider_free(this_ptr_conv);
9606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9607 if ((this_ptr & 1) != 0) return;
9608 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9609 FREE((void*)this_ptr);
9610 EventsProvider_free(this_ptr_conv);
9613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9614 if ((this_ptr & 1) != 0) return;
9615 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9616 FREE((void*)this_ptr);
9617 APIError_free(this_ptr_conv);
9620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9621 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9622 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9623 *ret_copy = APIError_clone(orig_conv);
9624 long ret_ref = (long)ret_copy;
9628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9629 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9630 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
9634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
9635 jclass ret_conv = LDKLevel_to_java(env, Level_max());
9639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9640 if ((this_ptr & 1) != 0) return;
9641 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9642 FREE((void*)this_ptr);
9643 Logger_free(this_ptr_conv);
9646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9647 LDKChannelHandshakeConfig this_ptr_conv;
9648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9650 ChannelHandshakeConfig_free(this_ptr_conv);
9653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9654 LDKChannelHandshakeConfig this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = false;
9657 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9662 LDKChannelHandshakeConfig this_ptr_conv;
9663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9664 this_ptr_conv.is_owned = false;
9665 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9668 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9669 LDKChannelHandshakeConfig this_ptr_conv;
9670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9671 this_ptr_conv.is_owned = false;
9672 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9676 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) {
9677 LDKChannelHandshakeConfig this_ptr_conv;
9678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9679 this_ptr_conv.is_owned = false;
9680 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9684 LDKChannelHandshakeConfig this_ptr_conv;
9685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9686 this_ptr_conv.is_owned = false;
9687 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9691 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) {
9692 LDKChannelHandshakeConfig this_ptr_conv;
9693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9694 this_ptr_conv.is_owned = false;
9695 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9698 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) {
9699 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9702 long ret_ref = (long)ret_var.inner;
9703 if (ret_var.is_owned) {
9709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9710 LDKChannelHandshakeConfig orig_conv;
9711 orig_conv.inner = (void*)(orig & (~1));
9712 orig_conv.is_owned = false;
9713 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9716 long ret_ref = (long)ret_var.inner;
9717 if (ret_var.is_owned) {
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
9724 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9727 long ret_ref = (long)ret_var.inner;
9728 if (ret_var.is_owned) {
9734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9735 LDKChannelHandshakeLimits this_ptr_conv;
9736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9738 ChannelHandshakeLimits_free(this_ptr_conv);
9741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9742 LDKChannelHandshakeLimits this_ptr_conv;
9743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9744 this_ptr_conv.is_owned = false;
9745 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9750 LDKChannelHandshakeLimits this_ptr_conv;
9751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9752 this_ptr_conv.is_owned = false;
9753 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9757 LDKChannelHandshakeLimits this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = false;
9760 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
9764 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) {
9765 LDKChannelHandshakeLimits this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = false;
9768 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
9771 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) {
9772 LDKChannelHandshakeLimits this_ptr_conv;
9773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9774 this_ptr_conv.is_owned = false;
9775 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
9779 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) {
9780 LDKChannelHandshakeLimits this_ptr_conv;
9781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9782 this_ptr_conv.is_owned = false;
9783 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9787 LDKChannelHandshakeLimits this_ptr_conv;
9788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9789 this_ptr_conv.is_owned = false;
9790 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
9794 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) {
9795 LDKChannelHandshakeLimits this_ptr_conv;
9796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9797 this_ptr_conv.is_owned = false;
9798 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
9801 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9802 LDKChannelHandshakeLimits this_ptr_conv;
9803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9804 this_ptr_conv.is_owned = false;
9805 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9809 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) {
9810 LDKChannelHandshakeLimits this_ptr_conv;
9811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9812 this_ptr_conv.is_owned = false;
9813 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9817 LDKChannelHandshakeLimits this_ptr_conv;
9818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9819 this_ptr_conv.is_owned = false;
9820 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9824 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) {
9825 LDKChannelHandshakeLimits this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = false;
9828 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9832 LDKChannelHandshakeLimits this_ptr_conv;
9833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9834 this_ptr_conv.is_owned = false;
9835 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9839 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) {
9840 LDKChannelHandshakeLimits this_ptr_conv;
9841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9842 this_ptr_conv.is_owned = false;
9843 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9846 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9847 LDKChannelHandshakeLimits this_ptr_conv;
9848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9849 this_ptr_conv.is_owned = false;
9850 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9855 LDKChannelHandshakeLimits this_ptr_conv;
9856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9857 this_ptr_conv.is_owned = false;
9858 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
9862 LDKChannelHandshakeLimits this_ptr_conv;
9863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9864 this_ptr_conv.is_owned = false;
9865 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9870 LDKChannelHandshakeLimits this_ptr_conv;
9871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9872 this_ptr_conv.is_owned = false;
9873 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9876 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9877 LDKChannelHandshakeLimits this_ptr_conv;
9878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9879 this_ptr_conv.is_owned = false;
9880 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9884 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) {
9885 LDKChannelHandshakeLimits this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = false;
9888 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9891 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) {
9892 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);
9893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9895 long ret_ref = (long)ret_var.inner;
9896 if (ret_var.is_owned) {
9902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9903 LDKChannelHandshakeLimits orig_conv;
9904 orig_conv.inner = (void*)(orig & (~1));
9905 orig_conv.is_owned = false;
9906 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9907 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9908 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9909 long ret_ref = (long)ret_var.inner;
9910 if (ret_var.is_owned) {
9916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
9917 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9920 long ret_ref = (long)ret_var.inner;
9921 if (ret_var.is_owned) {
9927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9928 LDKChannelConfig this_ptr_conv;
9929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9931 ChannelConfig_free(this_ptr_conv);
9934 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
9935 LDKChannelConfig this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = false;
9938 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9943 LDKChannelConfig this_ptr_conv;
9944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9945 this_ptr_conv.is_owned = false;
9946 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
9950 LDKChannelConfig this_ptr_conv;
9951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9952 this_ptr_conv.is_owned = false;
9953 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9958 LDKChannelConfig this_ptr_conv;
9959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9960 this_ptr_conv.is_owned = false;
9961 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
9965 LDKChannelConfig this_ptr_conv;
9966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9967 this_ptr_conv.is_owned = false;
9968 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9973 LDKChannelConfig this_ptr_conv;
9974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9975 this_ptr_conv.is_owned = false;
9976 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9979 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) {
9980 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9983 long ret_ref = (long)ret_var.inner;
9984 if (ret_var.is_owned) {
9990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9991 LDKChannelConfig orig_conv;
9992 orig_conv.inner = (void*)(orig & (~1));
9993 orig_conv.is_owned = false;
9994 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9995 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9996 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9997 long ret_ref = (long)ret_var.inner;
9998 if (ret_var.is_owned) {
10004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
10005 LDKChannelConfig ret_var = ChannelConfig_default();
10006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10008 long ret_ref = (long)ret_var.inner;
10009 if (ret_var.is_owned) {
10015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
10016 LDKChannelConfig obj_conv;
10017 obj_conv.inner = (void*)(obj & (~1));
10018 obj_conv.is_owned = false;
10019 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
10020 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10021 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10022 CVec_u8Z_free(ret_var);
10026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10027 LDKu8slice ser_ref;
10028 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10029 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10030 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10031 *ret_conv = ChannelConfig_read(ser_ref);
10032 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10033 return (long)ret_conv;
10036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10037 LDKUserConfig this_ptr_conv;
10038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10040 UserConfig_free(this_ptr_conv);
10043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
10044 LDKUserConfig this_ptr_conv;
10045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10046 this_ptr_conv.is_owned = false;
10047 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
10048 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10049 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10050 long ret_ref = (long)ret_var.inner;
10051 if (ret_var.is_owned) {
10057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10058 LDKUserConfig this_ptr_conv;
10059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10060 this_ptr_conv.is_owned = false;
10061 LDKChannelHandshakeConfig val_conv;
10062 val_conv.inner = (void*)(val & (~1));
10063 val_conv.is_owned = (val & 1) || (val == 0);
10064 val_conv = ChannelHandshakeConfig_clone(&val_conv);
10065 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
10068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
10069 LDKUserConfig this_ptr_conv;
10070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10071 this_ptr_conv.is_owned = false;
10072 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
10073 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10074 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10075 long ret_ref = (long)ret_var.inner;
10076 if (ret_var.is_owned) {
10082 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) {
10083 LDKUserConfig this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = false;
10086 LDKChannelHandshakeLimits val_conv;
10087 val_conv.inner = (void*)(val & (~1));
10088 val_conv.is_owned = (val & 1) || (val == 0);
10089 val_conv = ChannelHandshakeLimits_clone(&val_conv);
10090 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
10093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
10094 LDKUserConfig this_ptr_conv;
10095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10096 this_ptr_conv.is_owned = false;
10097 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
10098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10100 long ret_ref = (long)ret_var.inner;
10101 if (ret_var.is_owned) {
10107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10108 LDKUserConfig this_ptr_conv;
10109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10110 this_ptr_conv.is_owned = false;
10111 LDKChannelConfig val_conv;
10112 val_conv.inner = (void*)(val & (~1));
10113 val_conv.is_owned = (val & 1) || (val == 0);
10114 val_conv = ChannelConfig_clone(&val_conv);
10115 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
10118 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) {
10119 LDKChannelHandshakeConfig own_channel_config_arg_conv;
10120 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
10121 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
10122 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
10123 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
10124 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
10125 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
10126 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
10127 LDKChannelConfig channel_options_arg_conv;
10128 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
10129 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
10130 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
10131 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
10132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10134 long ret_ref = (long)ret_var.inner;
10135 if (ret_var.is_owned) {
10141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10142 LDKUserConfig orig_conv;
10143 orig_conv.inner = (void*)(orig & (~1));
10144 orig_conv.is_owned = false;
10145 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
10146 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10147 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10148 long ret_ref = (long)ret_var.inner;
10149 if (ret_var.is_owned) {
10155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
10156 LDKUserConfig ret_var = UserConfig_default();
10157 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10158 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10159 long ret_ref = (long)ret_var.inner;
10160 if (ret_var.is_owned) {
10166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10167 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
10168 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
10172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10173 if ((this_ptr & 1) != 0) return;
10174 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
10175 FREE((void*)this_ptr);
10176 Access_free(this_ptr_conv);
10179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10180 if ((this_ptr & 1) != 0) return;
10181 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
10182 FREE((void*)this_ptr);
10183 Listen_free(this_ptr_conv);
10186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10187 if ((this_ptr & 1) != 0) return;
10188 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
10189 FREE((void*)this_ptr);
10190 Watch_free(this_ptr_conv);
10193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10194 if ((this_ptr & 1) != 0) return;
10195 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
10196 FREE((void*)this_ptr);
10197 Filter_free(this_ptr_conv);
10200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10201 if ((this_ptr & 1) != 0) return;
10202 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
10203 FREE((void*)this_ptr);
10204 BroadcasterInterface_free(this_ptr_conv);
10207 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10208 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
10209 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
10213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10214 if ((this_ptr & 1) != 0) return;
10215 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
10216 FREE((void*)this_ptr);
10217 FeeEstimator_free(this_ptr_conv);
10220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10221 LDKChainMonitor this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10224 ChainMonitor_free(this_ptr_conv);
10227 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) {
10228 LDKChainMonitor this_arg_conv;
10229 this_arg_conv.inner = (void*)(this_arg & (~1));
10230 this_arg_conv.is_owned = false;
10231 unsigned char header_arr[80];
10232 CHECK((*env)->GetArrayLength(env, header) == 80);
10233 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10234 unsigned char (*header_ref)[80] = &header_arr;
10235 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10236 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10237 if (txdata_constr.datalen > 0)
10238 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10240 txdata_constr.data = NULL;
10241 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10242 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10243 int64_t txdata_conv_24 = txdata_vals[y];
10244 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10245 FREE((void*)txdata_conv_24);
10246 txdata_constr.data[y] = txdata_conv_24_conv;
10248 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10249 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10252 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) {
10253 LDKChainMonitor this_arg_conv;
10254 this_arg_conv.inner = (void*)(this_arg & (~1));
10255 this_arg_conv.is_owned = false;
10256 unsigned char header_arr[80];
10257 CHECK((*env)->GetArrayLength(env, header) == 80);
10258 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10259 unsigned char (*header_ref)[80] = &header_arr;
10260 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
10263 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) {
10264 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
10265 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10266 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10267 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10268 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10270 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10271 if (logger_conv.free == LDKLogger_JCalls_free) {
10272 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10273 LDKLogger_JCalls_clone(logger_conv.this_arg);
10275 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10276 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
10277 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10278 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
10280 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10281 if (persister_conv.free == LDKPersist_JCalls_free) {
10282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10283 LDKPersist_JCalls_clone(persister_conv.this_arg);
10285 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10288 long ret_ref = (long)ret_var.inner;
10289 if (ret_var.is_owned) {
10295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10296 LDKChainMonitor this_arg_conv;
10297 this_arg_conv.inner = (void*)(this_arg & (~1));
10298 this_arg_conv.is_owned = false;
10299 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10300 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
10305 LDKChainMonitor this_arg_conv;
10306 this_arg_conv.inner = (void*)(this_arg & (~1));
10307 this_arg_conv.is_owned = false;
10308 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10309 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10314 LDKChannelMonitorUpdate this_ptr_conv;
10315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10317 ChannelMonitorUpdate_free(this_ptr_conv);
10320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10321 LDKChannelMonitorUpdate this_ptr_conv;
10322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10323 this_ptr_conv.is_owned = false;
10324 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10329 LDKChannelMonitorUpdate this_ptr_conv;
10330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10331 this_ptr_conv.is_owned = false;
10332 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10336 LDKChannelMonitorUpdate orig_conv;
10337 orig_conv.inner = (void*)(orig & (~1));
10338 orig_conv.is_owned = false;
10339 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10340 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10341 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10342 long ret_ref = (long)ret_var.inner;
10343 if (ret_var.is_owned) {
10349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10350 LDKChannelMonitorUpdate obj_conv;
10351 obj_conv.inner = (void*)(obj & (~1));
10352 obj_conv.is_owned = false;
10353 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10354 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10355 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10356 CVec_u8Z_free(ret_var);
10360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10361 LDKu8slice ser_ref;
10362 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10363 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10364 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10365 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10366 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10367 return (long)ret_conv;
10370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10371 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10372 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
10376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10377 LDKMonitorUpdateError this_ptr_conv;
10378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10380 MonitorUpdateError_free(this_ptr_conv);
10383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10384 LDKMonitorUpdateError orig_conv;
10385 orig_conv.inner = (void*)(orig & (~1));
10386 orig_conv.is_owned = false;
10387 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
10388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10390 long ret_ref = (long)ret_var.inner;
10391 if (ret_var.is_owned) {
10397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10398 if ((this_ptr & 1) != 0) return;
10399 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
10400 FREE((void*)this_ptr);
10401 MonitorEvent_free(this_ptr_conv);
10404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10405 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
10406 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10407 *ret_copy = MonitorEvent_clone(orig_conv);
10408 long ret_ref = (long)ret_copy;
10412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10413 LDKHTLCUpdate this_ptr_conv;
10414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10416 HTLCUpdate_free(this_ptr_conv);
10419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10420 LDKHTLCUpdate orig_conv;
10421 orig_conv.inner = (void*)(orig & (~1));
10422 orig_conv.is_owned = false;
10423 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10424 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10425 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10426 long ret_ref = (long)ret_var.inner;
10427 if (ret_var.is_owned) {
10433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10434 LDKHTLCUpdate obj_conv;
10435 obj_conv.inner = (void*)(obj & (~1));
10436 obj_conv.is_owned = false;
10437 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
10438 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10439 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10440 CVec_u8Z_free(ret_var);
10444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10445 LDKu8slice ser_ref;
10446 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10447 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10448 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10449 *ret_conv = HTLCUpdate_read(ser_ref);
10450 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10451 return (long)ret_conv;
10454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10455 LDKChannelMonitor this_ptr_conv;
10456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10458 ChannelMonitor_free(this_ptr_conv);
10461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10462 LDKChannelMonitor orig_conv;
10463 orig_conv.inner = (void*)(orig & (~1));
10464 orig_conv.is_owned = false;
10465 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10466 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10467 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10468 long ret_ref = (long)ret_var.inner;
10469 if (ret_var.is_owned) {
10475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
10476 LDKChannelMonitor obj_conv;
10477 obj_conv.inner = (void*)(obj & (~1));
10478 obj_conv.is_owned = false;
10479 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
10480 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10481 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10482 CVec_u8Z_free(ret_var);
10486 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) {
10487 LDKChannelMonitor this_arg_conv;
10488 this_arg_conv.inner = (void*)(this_arg & (~1));
10489 this_arg_conv.is_owned = false;
10490 LDKChannelMonitorUpdate updates_conv;
10491 updates_conv.inner = (void*)(updates & (~1));
10492 updates_conv.is_owned = false;
10493 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
10494 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
10495 LDKLogger* logger_conv = (LDKLogger*)logger;
10496 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10497 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10498 return (long)ret_conv;
10501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10502 LDKChannelMonitor this_arg_conv;
10503 this_arg_conv.inner = (void*)(this_arg & (~1));
10504 this_arg_conv.is_owned = false;
10505 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
10510 LDKChannelMonitor this_arg_conv;
10511 this_arg_conv.inner = (void*)(this_arg & (~1));
10512 this_arg_conv.is_owned = false;
10513 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10514 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10515 return (long)ret_ref;
10518 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10519 LDKChannelMonitor this_arg_conv;
10520 this_arg_conv.inner = (void*)(this_arg & (~1));
10521 this_arg_conv.is_owned = false;
10522 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10523 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10524 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10525 for (size_t o = 0; o < ret_var.datalen; o++) {
10526 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10527 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10528 long ret_conv_14_ref = (long)ret_conv_14_copy;
10529 ret_arr_ptr[o] = ret_conv_14_ref;
10531 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10532 FREE(ret_var.data);
10536 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10537 LDKChannelMonitor this_arg_conv;
10538 this_arg_conv.inner = (void*)(this_arg & (~1));
10539 this_arg_conv.is_owned = false;
10540 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10541 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10542 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10543 for (size_t h = 0; h < ret_var.datalen; h++) {
10544 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10545 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10546 long ret_conv_7_ref = (long)ret_conv_7_copy;
10547 ret_arr_ptr[h] = ret_conv_7_ref;
10549 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10550 FREE(ret_var.data);
10554 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) {
10555 LDKChannelMonitor this_arg_conv;
10556 this_arg_conv.inner = (void*)(this_arg & (~1));
10557 this_arg_conv.is_owned = false;
10558 LDKLogger* logger_conv = (LDKLogger*)logger;
10559 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10560 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10562 for (size_t i = 0; i < ret_var.datalen; i++) {
10563 LDKTransaction ret_conv_8_var = ret_var.data[i];
10564 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
10565 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
10566 Transaction_free(ret_conv_8_var);
10567 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10569 FREE(ret_var.data);
10573 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) {
10574 LDKChannelMonitor this_arg_conv;
10575 this_arg_conv.inner = (void*)(this_arg & (~1));
10576 this_arg_conv.is_owned = false;
10577 unsigned char header_arr[80];
10578 CHECK((*env)->GetArrayLength(env, header) == 80);
10579 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10580 unsigned char (*header_ref)[80] = &header_arr;
10581 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10582 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10583 if (txdata_constr.datalen > 0)
10584 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10586 txdata_constr.data = NULL;
10587 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10588 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10589 int64_t txdata_conv_24 = txdata_vals[y];
10590 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10591 FREE((void*)txdata_conv_24);
10592 txdata_constr.data[y] = txdata_conv_24_conv;
10594 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10595 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10596 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10598 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10600 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10601 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10603 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10605 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10606 if (logger_conv.free == LDKLogger_JCalls_free) {
10607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10608 LDKLogger_JCalls_clone(logger_conv.this_arg);
10610 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);
10611 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10612 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10613 for (size_t u = 0; u < ret_var.datalen; u++) {
10614 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10615 *ret_conv_46_ref = ret_var.data[u];
10616 ret_arr_ptr[u] = (long)ret_conv_46_ref;
10618 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10619 FREE(ret_var.data);
10623 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) {
10624 LDKChannelMonitor this_arg_conv;
10625 this_arg_conv.inner = (void*)(this_arg & (~1));
10626 this_arg_conv.is_owned = false;
10627 unsigned char header_arr[80];
10628 CHECK((*env)->GetArrayLength(env, header) == 80);
10629 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10630 unsigned char (*header_ref)[80] = &header_arr;
10631 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10632 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10633 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10634 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10636 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10637 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10638 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10639 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10641 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10642 if (logger_conv.free == LDKLogger_JCalls_free) {
10643 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10644 LDKLogger_JCalls_clone(logger_conv.this_arg);
10646 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10650 if ((this_ptr & 1) != 0) return;
10651 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10652 FREE((void*)this_ptr);
10653 Persist_free(this_ptr_conv);
10656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
10657 LDKu8slice ser_ref;
10658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10660 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
10661 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10662 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10663 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10664 return (long)ret_conv;
10667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10668 LDKOutPoint this_ptr_conv;
10669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10671 OutPoint_free(this_ptr_conv);
10674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10675 LDKOutPoint this_ptr_conv;
10676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10677 this_ptr_conv.is_owned = false;
10678 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10679 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
10683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10684 LDKOutPoint this_ptr_conv;
10685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10686 this_ptr_conv.is_owned = false;
10687 LDKThirtyTwoBytes val_ref;
10688 CHECK((*env)->GetArrayLength(env, val) == 32);
10689 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10690 OutPoint_set_txid(&this_ptr_conv, val_ref);
10693 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10694 LDKOutPoint this_ptr_conv;
10695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10696 this_ptr_conv.is_owned = false;
10697 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10702 LDKOutPoint this_ptr_conv;
10703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10704 this_ptr_conv.is_owned = false;
10705 OutPoint_set_index(&this_ptr_conv, val);
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
10709 LDKThirtyTwoBytes txid_arg_ref;
10710 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
10711 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
10712 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10715 long ret_ref = (long)ret_var.inner;
10716 if (ret_var.is_owned) {
10722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10723 LDKOutPoint orig_conv;
10724 orig_conv.inner = (void*)(orig & (~1));
10725 orig_conv.is_owned = false;
10726 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
10727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10729 long ret_ref = (long)ret_var.inner;
10730 if (ret_var.is_owned) {
10736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10737 LDKOutPoint this_arg_conv;
10738 this_arg_conv.inner = (void*)(this_arg & (~1));
10739 this_arg_conv.is_owned = false;
10740 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10741 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
10745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
10746 LDKOutPoint obj_conv;
10747 obj_conv.inner = (void*)(obj & (~1));
10748 obj_conv.is_owned = false;
10749 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
10750 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10751 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10752 CVec_u8Z_free(ret_var);
10756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10757 LDKu8slice ser_ref;
10758 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10759 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10760 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10761 *ret_conv = OutPoint_read(ser_ref);
10762 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10763 return (long)ret_conv;
10766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10767 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10770 DelayedPaymentOutputDescriptor_free(this_ptr_conv);
10773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10774 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10776 this_ptr_conv.is_owned = false;
10777 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10780 long ret_ref = (long)ret_var.inner;
10781 if (ret_var.is_owned) {
10787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10788 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10790 this_ptr_conv.is_owned = false;
10791 LDKOutPoint val_conv;
10792 val_conv.inner = (void*)(val & (~1));
10793 val_conv.is_owned = (val & 1) || (val == 0);
10794 val_conv = OutPoint_clone(&val_conv);
10795 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10799 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10801 this_ptr_conv.is_owned = false;
10802 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10803 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
10807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10808 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10810 this_ptr_conv.is_owned = false;
10811 LDKPublicKey val_ref;
10812 CHECK((*env)->GetArrayLength(env, val) == 33);
10813 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10814 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
10817 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10818 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10820 this_ptr_conv.is_owned = false;
10821 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
10825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10826 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10828 this_ptr_conv.is_owned = false;
10829 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
10832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10833 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10835 this_ptr_conv.is_owned = false;
10836 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10838 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10842 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10844 this_ptr_conv.is_owned = false;
10845 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10846 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
10850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10851 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = false;
10854 LDKPublicKey val_ref;
10855 CHECK((*env)->GetArrayLength(env, val) == 33);
10856 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10857 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
10860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10861 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10863 this_ptr_conv.is_owned = false;
10864 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10865 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
10869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10870 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10872 this_ptr_conv.is_owned = false;
10873 LDKThirtyTwoBytes val_ref;
10874 CHECK((*env)->GetArrayLength(env, val) == 32);
10875 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10876 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10880 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10882 this_ptr_conv.is_owned = false;
10883 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10888 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10890 this_ptr_conv.is_owned = false;
10891 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
10895 LDKOutPoint outpoint_arg_conv;
10896 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10897 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10898 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10899 LDKPublicKey per_commitment_point_arg_ref;
10900 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
10901 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
10902 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10903 FREE((void*)output_arg);
10904 LDKPublicKey revocation_pubkey_arg_ref;
10905 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
10906 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
10907 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10908 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
10909 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
10910 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10913 long ret_ref = (long)ret_var.inner;
10914 if (ret_var.is_owned) {
10920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10921 LDKDelayedPaymentOutputDescriptor orig_conv;
10922 orig_conv.inner = (void*)(orig & (~1));
10923 orig_conv.is_owned = false;
10924 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_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 void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10935 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10938 StaticPaymentOutputDescriptor_free(this_ptr_conv);
10941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10942 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10944 this_ptr_conv.is_owned = false;
10945 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10946 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10947 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10948 long ret_ref = (long)ret_var.inner;
10949 if (ret_var.is_owned) {
10955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10956 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10958 this_ptr_conv.is_owned = false;
10959 LDKOutPoint val_conv;
10960 val_conv.inner = (void*)(val & (~1));
10961 val_conv.is_owned = (val & 1) || (val == 0);
10962 val_conv = OutPoint_clone(&val_conv);
10963 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10967 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10969 this_ptr_conv.is_owned = false;
10970 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10972 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10976 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10978 this_ptr_conv.is_owned = false;
10979 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10980 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10985 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10987 this_ptr_conv.is_owned = false;
10988 LDKThirtyTwoBytes val_ref;
10989 CHECK((*env)->GetArrayLength(env, val) == 32);
10990 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10991 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10995 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10997 this_ptr_conv.is_owned = false;
10998 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11003 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11005 this_ptr_conv.is_owned = false;
11006 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
11010 LDKOutPoint outpoint_arg_conv;
11011 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11012 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11013 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11014 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11015 FREE((void*)output_arg);
11016 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11017 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11018 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11019 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
11020 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11021 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11022 long ret_ref = (long)ret_var.inner;
11023 if (ret_var.is_owned) {
11029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11030 LDKStaticPaymentOutputDescriptor orig_conv;
11031 orig_conv.inner = (void*)(orig & (~1));
11032 orig_conv.is_owned = false;
11033 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
11034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11036 long ret_ref = (long)ret_var.inner;
11037 if (ret_var.is_owned) {
11043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11044 if ((this_ptr & 1) != 0) return;
11045 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
11046 FREE((void*)this_ptr);
11047 SpendableOutputDescriptor_free(this_ptr_conv);
11050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11051 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
11052 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
11053 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
11054 long ret_ref = (long)ret_copy;
11058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
11059 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
11060 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
11061 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11062 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11063 CVec_u8Z_free(ret_var);
11067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11068 LDKu8slice ser_ref;
11069 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11070 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11071 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11072 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
11073 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11074 return (long)ret_conv;
11077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11078 LDKSign* orig_conv = (LDKSign*)orig;
11079 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11080 *ret = Sign_clone(orig_conv);
11084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11085 if ((this_ptr & 1) != 0) return;
11086 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
11087 FREE((void*)this_ptr);
11088 Sign_free(this_ptr_conv);
11091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11092 if ((this_ptr & 1) != 0) return;
11093 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
11094 FREE((void*)this_ptr);
11095 KeysInterface_free(this_ptr_conv);
11098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11099 LDKInMemorySigner this_ptr_conv;
11100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11102 InMemorySigner_free(this_ptr_conv);
11105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11106 LDKInMemorySigner this_ptr_conv;
11107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11108 this_ptr_conv.is_owned = false;
11109 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11110 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
11114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11115 LDKInMemorySigner this_ptr_conv;
11116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11117 this_ptr_conv.is_owned = false;
11118 LDKSecretKey val_ref;
11119 CHECK((*env)->GetArrayLength(env, val) == 32);
11120 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11121 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
11124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11125 LDKInMemorySigner this_ptr_conv;
11126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11127 this_ptr_conv.is_owned = false;
11128 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11129 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
11133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11134 LDKInMemorySigner this_ptr_conv;
11135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11136 this_ptr_conv.is_owned = false;
11137 LDKSecretKey val_ref;
11138 CHECK((*env)->GetArrayLength(env, val) == 32);
11139 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11140 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
11143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11144 LDKInMemorySigner this_ptr_conv;
11145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11146 this_ptr_conv.is_owned = false;
11147 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
11152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11153 LDKInMemorySigner this_ptr_conv;
11154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11155 this_ptr_conv.is_owned = false;
11156 LDKSecretKey val_ref;
11157 CHECK((*env)->GetArrayLength(env, val) == 32);
11158 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11159 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
11162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11163 LDKInMemorySigner this_ptr_conv;
11164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11165 this_ptr_conv.is_owned = false;
11166 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11167 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
11171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11172 LDKInMemorySigner this_ptr_conv;
11173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11174 this_ptr_conv.is_owned = false;
11175 LDKSecretKey val_ref;
11176 CHECK((*env)->GetArrayLength(env, val) == 32);
11177 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11178 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
11181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11182 LDKInMemorySigner this_ptr_conv;
11183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11184 this_ptr_conv.is_owned = false;
11185 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
11190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11191 LDKInMemorySigner this_ptr_conv;
11192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11193 this_ptr_conv.is_owned = false;
11194 LDKSecretKey val_ref;
11195 CHECK((*env)->GetArrayLength(env, val) == 32);
11196 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11197 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
11201 LDKInMemorySigner this_ptr_conv;
11202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11203 this_ptr_conv.is_owned = false;
11204 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11205 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
11209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11210 LDKInMemorySigner this_ptr_conv;
11211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11212 this_ptr_conv.is_owned = false;
11213 LDKThirtyTwoBytes val_ref;
11214 CHECK((*env)->GetArrayLength(env, val) == 32);
11215 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11216 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11220 LDKInMemorySigner orig_conv;
11221 orig_conv.inner = (void*)(orig & (~1));
11222 orig_conv.is_owned = false;
11223 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11226 long ret_ref = (long)ret_var.inner;
11227 if (ret_var.is_owned) {
11233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_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, int8_tArray channel_keys_id) {
11234 LDKSecretKey funding_key_ref;
11235 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
11236 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
11237 LDKSecretKey revocation_base_key_ref;
11238 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
11239 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
11240 LDKSecretKey payment_key_ref;
11241 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
11242 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
11243 LDKSecretKey delayed_payment_base_key_ref;
11244 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
11245 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
11246 LDKSecretKey htlc_base_key_ref;
11247 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
11248 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
11249 LDKThirtyTwoBytes commitment_seed_ref;
11250 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
11251 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
11252 LDKThirtyTwoBytes channel_keys_id_ref;
11253 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
11254 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
11255 LDKInMemorySigner ret_var = InMemorySigner_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, channel_keys_id_ref);
11256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11258 long ret_ref = (long)ret_var.inner;
11259 if (ret_var.is_owned) {
11265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
11266 LDKInMemorySigner this_arg_conv;
11267 this_arg_conv.inner = (void*)(this_arg & (~1));
11268 this_arg_conv.is_owned = false;
11269 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11270 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11271 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11272 long ret_ref = (long)ret_var.inner;
11273 if (ret_var.is_owned) {
11279 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11280 LDKInMemorySigner this_arg_conv;
11281 this_arg_conv.inner = (void*)(this_arg & (~1));
11282 this_arg_conv.is_owned = false;
11283 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11287 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11288 LDKInMemorySigner this_arg_conv;
11289 this_arg_conv.inner = (void*)(this_arg & (~1));
11290 this_arg_conv.is_owned = false;
11291 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
11296 LDKInMemorySigner this_arg_conv;
11297 this_arg_conv.inner = (void*)(this_arg & (~1));
11298 this_arg_conv.is_owned = false;
11299 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
11304 LDKInMemorySigner this_arg_conv;
11305 this_arg_conv.inner = (void*)(this_arg & (~1));
11306 this_arg_conv.is_owned = false;
11307 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11308 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11309 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11310 long ret_ref = (long)ret_var.inner;
11311 if (ret_var.is_owned) {
11317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
11318 LDKInMemorySigner this_arg_conv;
11319 this_arg_conv.inner = (void*)(this_arg & (~1));
11320 this_arg_conv.is_owned = false;
11321 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11324 long ret_ref = (long)ret_var.inner;
11325 if (ret_var.is_owned) {
11331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
11332 LDKInMemorySigner this_arg_conv;
11333 this_arg_conv.inner = (void*)(this_arg & (~1));
11334 this_arg_conv.is_owned = false;
11335 LDKTransaction spend_tx_ref;
11336 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11337 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11338 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11339 spend_tx_ref.data_is_owned = true;
11340 LDKStaticPaymentOutputDescriptor descriptor_conv;
11341 descriptor_conv.inner = (void*)(descriptor & (~1));
11342 descriptor_conv.is_owned = false;
11343 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11344 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11345 return (long)ret_conv;
11348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
11349 LDKInMemorySigner this_arg_conv;
11350 this_arg_conv.inner = (void*)(this_arg & (~1));
11351 this_arg_conv.is_owned = false;
11352 LDKTransaction spend_tx_ref;
11353 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11354 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11355 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11356 spend_tx_ref.data_is_owned = true;
11357 LDKDelayedPaymentOutputDescriptor descriptor_conv;
11358 descriptor_conv.inner = (void*)(descriptor & (~1));
11359 descriptor_conv.is_owned = false;
11360 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11361 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11362 return (long)ret_conv;
11365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
11366 LDKInMemorySigner this_arg_conv;
11367 this_arg_conv.inner = (void*)(this_arg & (~1));
11368 this_arg_conv.is_owned = false;
11369 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11370 *ret = InMemorySigner_as_Sign(&this_arg_conv);
11374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
11375 LDKInMemorySigner obj_conv;
11376 obj_conv.inner = (void*)(obj & (~1));
11377 obj_conv.is_owned = false;
11378 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
11379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11381 CVec_u8Z_free(ret_var);
11385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11386 LDKu8slice ser_ref;
11387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11389 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11390 *ret_conv = InMemorySigner_read(ser_ref);
11391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11392 return (long)ret_conv;
11395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11396 LDKKeysManager this_ptr_conv;
11397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11399 KeysManager_free(this_ptr_conv);
11402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
11403 unsigned char seed_arr[32];
11404 CHECK((*env)->GetArrayLength(env, seed) == 32);
11405 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
11406 unsigned char (*seed_ref)[32] = &seed_arr;
11407 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
11408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11410 long ret_ref = (long)ret_var.inner;
11411 if (ret_var.is_owned) {
11417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
11418 LDKKeysManager this_arg_conv;
11419 this_arg_conv.inner = (void*)(this_arg & (~1));
11420 this_arg_conv.is_owned = false;
11421 unsigned char params_arr[32];
11422 CHECK((*env)->GetArrayLength(env, params) == 32);
11423 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
11424 unsigned char (*params_ref)[32] = ¶ms_arr;
11425 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
11426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11428 long ret_ref = (long)ret_var.inner;
11429 if (ret_var.is_owned) {
11435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
11436 LDKKeysManager this_arg_conv;
11437 this_arg_conv.inner = (void*)(this_arg & (~1));
11438 this_arg_conv.is_owned = false;
11439 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
11440 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
11441 if (descriptors_constr.datalen > 0)
11442 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11444 descriptors_constr.data = NULL;
11445 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
11446 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
11447 int64_t descriptors_conv_27 = descriptors_vals[b];
11448 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
11449 FREE((void*)descriptors_conv_27);
11450 descriptors_constr.data[b] = descriptors_conv_27_conv;
11452 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
11453 LDKCVec_TxOutZ outputs_constr;
11454 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
11455 if (outputs_constr.datalen > 0)
11456 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11458 outputs_constr.data = NULL;
11459 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
11460 for (size_t h = 0; h < outputs_constr.datalen; h++) {
11461 int64_t outputs_conv_7 = outputs_vals[h];
11462 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
11463 FREE((void*)outputs_conv_7);
11464 outputs_constr.data[h] = outputs_conv_7_conv;
11466 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
11467 LDKCVec_u8Z change_destination_script_ref;
11468 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
11469 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
11470 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
11471 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11472 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
11473 return (long)ret_conv;
11476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
11477 LDKKeysManager this_arg_conv;
11478 this_arg_conv.inner = (void*)(this_arg & (~1));
11479 this_arg_conv.is_owned = false;
11480 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
11481 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
11485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11486 LDKChannelManager this_ptr_conv;
11487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11489 ChannelManager_free(this_ptr_conv);
11492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11493 LDKChainParameters this_ptr_conv;
11494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11496 ChainParameters_free(this_ptr_conv);
11499 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
11500 LDKChainParameters this_ptr_conv;
11501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11502 this_ptr_conv.is_owned = false;
11503 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
11507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
11508 LDKChainParameters this_ptr_conv;
11509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11510 this_ptr_conv.is_owned = false;
11511 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
11512 ChainParameters_set_network(&this_ptr_conv, val_conv);
11515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11516 LDKChainParameters this_ptr_conv;
11517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11518 this_ptr_conv.is_owned = false;
11519 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChainParameters_get_latest_hash(&this_ptr_conv));
11524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11525 LDKChainParameters this_ptr_conv;
11526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11527 this_ptr_conv.is_owned = false;
11528 LDKThirtyTwoBytes val_ref;
11529 CHECK((*env)->GetArrayLength(env, val) == 32);
11530 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11531 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
11534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
11535 LDKChainParameters this_ptr_conv;
11536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11537 this_ptr_conv.is_owned = false;
11538 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
11542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11543 LDKChainParameters this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 ChainParameters_set_latest_height(&this_ptr_conv, val);
11549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int8_tArray latest_hash_arg, int64_t latest_height_arg) {
11550 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
11551 LDKThirtyTwoBytes latest_hash_arg_ref;
11552 CHECK((*env)->GetArrayLength(env, latest_hash_arg) == 32);
11553 (*env)->GetByteArrayRegion(env, latest_hash_arg, 0, 32, latest_hash_arg_ref.data);
11554 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
11555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11557 long ret_ref = (long)ret_var.inner;
11558 if (ret_var.is_owned) {
11564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11565 LDKChannelDetails this_ptr_conv;
11566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11568 ChannelDetails_free(this_ptr_conv);
11571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11572 LDKChannelDetails this_ptr_conv;
11573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11574 this_ptr_conv.is_owned = false;
11575 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
11580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11581 LDKChannelDetails this_ptr_conv;
11582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11583 this_ptr_conv.is_owned = false;
11584 LDKThirtyTwoBytes val_ref;
11585 CHECK((*env)->GetArrayLength(env, val) == 32);
11586 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11587 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11591 LDKChannelDetails this_ptr_conv;
11592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11593 this_ptr_conv.is_owned = false;
11594 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11595 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
11599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11600 LDKChannelDetails this_ptr_conv;
11601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11602 this_ptr_conv.is_owned = false;
11603 LDKPublicKey val_ref;
11604 CHECK((*env)->GetArrayLength(env, val) == 33);
11605 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11606 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11610 LDKChannelDetails this_ptr_conv;
11611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11612 this_ptr_conv.is_owned = false;
11613 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11614 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11615 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11616 long ret_ref = (long)ret_var.inner;
11617 if (ret_var.is_owned) {
11623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11624 LDKChannelDetails this_ptr_conv;
11625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11626 this_ptr_conv.is_owned = false;
11627 LDKInitFeatures val_conv;
11628 val_conv.inner = (void*)(val & (~1));
11629 val_conv.is_owned = (val & 1) || (val == 0);
11630 val_conv = InitFeatures_clone(&val_conv);
11631 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11635 LDKChannelDetails this_ptr_conv;
11636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11637 this_ptr_conv.is_owned = false;
11638 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11643 LDKChannelDetails this_ptr_conv;
11644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11645 this_ptr_conv.is_owned = false;
11646 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11650 LDKChannelDetails this_ptr_conv;
11651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11652 this_ptr_conv.is_owned = false;
11653 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11658 LDKChannelDetails this_ptr_conv;
11659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11660 this_ptr_conv.is_owned = false;
11661 ChannelDetails_set_user_id(&this_ptr_conv, val);
11664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11665 LDKChannelDetails this_ptr_conv;
11666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11667 this_ptr_conv.is_owned = false;
11668 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
11672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11673 LDKChannelDetails this_ptr_conv;
11674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11675 this_ptr_conv.is_owned = false;
11676 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
11679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11680 LDKChannelDetails this_ptr_conv;
11681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11682 this_ptr_conv.is_owned = false;
11683 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
11687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11688 LDKChannelDetails this_ptr_conv;
11689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11690 this_ptr_conv.is_owned = false;
11691 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
11694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
11695 LDKChannelDetails this_ptr_conv;
11696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11697 this_ptr_conv.is_owned = false;
11698 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
11702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
11703 LDKChannelDetails this_ptr_conv;
11704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11705 this_ptr_conv.is_owned = false;
11706 ChannelDetails_set_is_live(&this_ptr_conv, val);
11709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11710 LDKChannelDetails orig_conv;
11711 orig_conv.inner = (void*)(orig & (~1));
11712 orig_conv.is_owned = false;
11713 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
11714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11716 long ret_ref = (long)ret_var.inner;
11717 if (ret_var.is_owned) {
11723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11724 if ((this_ptr & 1) != 0) return;
11725 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
11726 FREE((void*)this_ptr);
11727 PaymentSendFailure_free(this_ptr_conv);
11730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11731 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
11732 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
11733 *ret_copy = PaymentSendFailure_clone(orig_conv);
11734 long ret_ref = (long)ret_copy;
11738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
11739 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
11740 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
11741 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11742 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
11744 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11745 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
11746 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11747 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
11749 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11750 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
11751 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11752 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
11754 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11755 if (logger_conv.free == LDKLogger_JCalls_free) {
11756 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11757 LDKLogger_JCalls_clone(logger_conv.this_arg);
11759 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11760 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
11761 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11762 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
11764 LDKUserConfig config_conv;
11765 config_conv.inner = (void*)(config & (~1));
11766 config_conv.is_owned = (config & 1) || (config == 0);
11767 config_conv = UserConfig_clone(&config_conv);
11768 LDKChainParameters params_conv;
11769 params_conv.inner = (void*)(params & (~1));
11770 params_conv.is_owned = (params & 1) || (params == 0);
11771 // Warning: we need a move here but no clone is available for LDKChainParameters
11772 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
11773 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11774 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11775 long ret_ref = (long)ret_var.inner;
11776 if (ret_var.is_owned) {
11782 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) {
11783 LDKChannelManager this_arg_conv;
11784 this_arg_conv.inner = (void*)(this_arg & (~1));
11785 this_arg_conv.is_owned = false;
11786 LDKPublicKey their_network_key_ref;
11787 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
11788 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
11789 LDKUserConfig override_config_conv;
11790 override_config_conv.inner = (void*)(override_config & (~1));
11791 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
11792 override_config_conv = UserConfig_clone(&override_config_conv);
11793 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11794 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
11795 return (long)ret_conv;
11798 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
11799 LDKChannelManager this_arg_conv;
11800 this_arg_conv.inner = (void*)(this_arg & (~1));
11801 this_arg_conv.is_owned = false;
11802 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
11803 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11804 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11805 for (size_t q = 0; q < ret_var.datalen; q++) {
11806 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11807 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11808 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11809 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11810 if (ret_conv_16_var.is_owned) {
11811 ret_conv_16_ref |= 1;
11813 ret_arr_ptr[q] = ret_conv_16_ref;
11815 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11816 FREE(ret_var.data);
11820 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
11821 LDKChannelManager this_arg_conv;
11822 this_arg_conv.inner = (void*)(this_arg & (~1));
11823 this_arg_conv.is_owned = false;
11824 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
11825 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11826 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11827 for (size_t q = 0; q < ret_var.datalen; q++) {
11828 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11829 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11830 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11831 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11832 if (ret_conv_16_var.is_owned) {
11833 ret_conv_16_ref |= 1;
11835 ret_arr_ptr[q] = ret_conv_16_ref;
11837 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11838 FREE(ret_var.data);
11842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
11843 LDKChannelManager this_arg_conv;
11844 this_arg_conv.inner = (void*)(this_arg & (~1));
11845 this_arg_conv.is_owned = false;
11846 unsigned char channel_id_arr[32];
11847 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
11848 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
11849 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11850 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11851 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11852 return (long)ret_conv;
11855 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) {
11856 LDKChannelManager this_arg_conv;
11857 this_arg_conv.inner = (void*)(this_arg & (~1));
11858 this_arg_conv.is_owned = false;
11859 unsigned char channel_id_arr[32];
11860 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
11861 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
11862 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11863 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11864 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11865 return (long)ret_conv;
11868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
11869 LDKChannelManager this_arg_conv;
11870 this_arg_conv.inner = (void*)(this_arg & (~1));
11871 this_arg_conv.is_owned = false;
11872 ChannelManager_force_close_all_channels(&this_arg_conv);
11875 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) {
11876 LDKChannelManager this_arg_conv;
11877 this_arg_conv.inner = (void*)(this_arg & (~1));
11878 this_arg_conv.is_owned = false;
11879 LDKRoute route_conv;
11880 route_conv.inner = (void*)(route & (~1));
11881 route_conv.is_owned = false;
11882 LDKThirtyTwoBytes payment_hash_ref;
11883 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11884 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
11885 LDKThirtyTwoBytes payment_secret_ref;
11886 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11887 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11888 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11889 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11890 return (long)ret_conv;
11893 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) {
11894 LDKChannelManager this_arg_conv;
11895 this_arg_conv.inner = (void*)(this_arg & (~1));
11896 this_arg_conv.is_owned = false;
11897 unsigned char temporary_channel_id_arr[32];
11898 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
11899 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
11900 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11901 LDKOutPoint funding_txo_conv;
11902 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11903 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
11904 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
11905 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
11908 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) {
11909 LDKChannelManager this_arg_conv;
11910 this_arg_conv.inner = (void*)(this_arg & (~1));
11911 this_arg_conv.is_owned = false;
11912 LDKThreeBytes rgb_ref;
11913 CHECK((*env)->GetArrayLength(env, rgb) == 3);
11914 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
11915 LDKThirtyTwoBytes alias_ref;
11916 CHECK((*env)->GetArrayLength(env, alias) == 32);
11917 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
11918 LDKCVec_NetAddressZ addresses_constr;
11919 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
11920 if (addresses_constr.datalen > 0)
11921 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11923 addresses_constr.data = NULL;
11924 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
11925 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11926 int64_t addresses_conv_12 = addresses_vals[m];
11927 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
11928 FREE((void*)addresses_conv_12);
11929 addresses_constr.data[m] = addresses_conv_12_conv;
11931 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
11932 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
11936 LDKChannelManager this_arg_conv;
11937 this_arg_conv.inner = (void*)(this_arg & (~1));
11938 this_arg_conv.is_owned = false;
11939 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
11943 LDKChannelManager this_arg_conv;
11944 this_arg_conv.inner = (void*)(this_arg & (~1));
11945 this_arg_conv.is_owned = false;
11946 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
11949 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) {
11950 LDKChannelManager this_arg_conv;
11951 this_arg_conv.inner = (void*)(this_arg & (~1));
11952 this_arg_conv.is_owned = false;
11953 unsigned char payment_hash_arr[32];
11954 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11955 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
11956 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11957 LDKThirtyTwoBytes payment_secret_ref;
11958 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11959 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11960 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11964 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) {
11965 LDKChannelManager this_arg_conv;
11966 this_arg_conv.inner = (void*)(this_arg & (~1));
11967 this_arg_conv.is_owned = false;
11968 LDKThirtyTwoBytes payment_preimage_ref;
11969 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
11970 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
11971 LDKThirtyTwoBytes payment_secret_ref;
11972 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11973 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11974 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11979 LDKChannelManager this_arg_conv;
11980 this_arg_conv.inner = (void*)(this_arg & (~1));
11981 this_arg_conv.is_owned = false;
11982 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
11987 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) {
11988 LDKChannelManager this_arg_conv;
11989 this_arg_conv.inner = (void*)(this_arg & (~1));
11990 this_arg_conv.is_owned = false;
11991 LDKOutPoint funding_txo_conv;
11992 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11993 funding_txo_conv.is_owned = false;
11994 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
11998 LDKChannelManager this_arg_conv;
11999 this_arg_conv.inner = (void*)(this_arg & (~1));
12000 this_arg_conv.is_owned = false;
12001 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12002 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
12006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12007 LDKChannelManager this_arg_conv;
12008 this_arg_conv.inner = (void*)(this_arg & (~1));
12009 this_arg_conv.is_owned = false;
12010 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12011 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
12015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
12016 LDKChannelManager this_arg_conv;
12017 this_arg_conv.inner = (void*)(this_arg & (~1));
12018 this_arg_conv.is_owned = false;
12019 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12020 *ret = ChannelManager_as_Listen(&this_arg_conv);
12024 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) {
12025 LDKChannelManager this_arg_conv;
12026 this_arg_conv.inner = (void*)(this_arg & (~1));
12027 this_arg_conv.is_owned = false;
12028 unsigned char header_arr[80];
12029 CHECK((*env)->GetArrayLength(env, header) == 80);
12030 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12031 unsigned char (*header_ref)[80] = &header_arr;
12032 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12033 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12034 if (txdata_constr.datalen > 0)
12035 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12037 txdata_constr.data = NULL;
12038 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12039 for (size_t y = 0; y < txdata_constr.datalen; y++) {
12040 int64_t txdata_conv_24 = txdata_vals[y];
12041 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
12042 FREE((void*)txdata_conv_24);
12043 txdata_constr.data[y] = txdata_conv_24_conv;
12045 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12046 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
12049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
12050 LDKChannelManager this_arg_conv;
12051 this_arg_conv.inner = (void*)(this_arg & (~1));
12052 this_arg_conv.is_owned = false;
12053 unsigned char header_arr[80];
12054 CHECK((*env)->GetArrayLength(env, header) == 80);
12055 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12056 unsigned char (*header_ref)[80] = &header_arr;
12057 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
12060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
12061 LDKChannelManager this_arg_conv;
12062 this_arg_conv.inner = (void*)(this_arg & (~1));
12063 this_arg_conv.is_owned = false;
12064 ChannelManager_await_persistable_update(&this_arg_conv);
12067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
12068 LDKChannelManager this_arg_conv;
12069 this_arg_conv.inner = (void*)(this_arg & (~1));
12070 this_arg_conv.is_owned = false;
12071 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12072 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
12076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
12077 LDKChannelManager obj_conv;
12078 obj_conv.inner = (void*)(obj & (~1));
12079 obj_conv.is_owned = false;
12080 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
12081 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12082 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12083 CVec_u8Z_free(ret_var);
12087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12088 LDKChannelManagerReadArgs this_ptr_conv;
12089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12091 ChannelManagerReadArgs_free(this_ptr_conv);
12094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
12095 LDKChannelManagerReadArgs this_ptr_conv;
12096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12097 this_ptr_conv.is_owned = false;
12098 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12103 LDKChannelManagerReadArgs this_ptr_conv;
12104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12105 this_ptr_conv.is_owned = false;
12106 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12107 if (val_conv.free == LDKKeysInterface_JCalls_free) {
12108 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12109 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
12111 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
12115 LDKChannelManagerReadArgs this_ptr_conv;
12116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12117 this_ptr_conv.is_owned = false;
12118 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12123 LDKChannelManagerReadArgs this_ptr_conv;
12124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12125 this_ptr_conv.is_owned = false;
12126 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12127 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
12128 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12129 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
12131 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
12135 LDKChannelManagerReadArgs this_ptr_conv;
12136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12137 this_ptr_conv.is_owned = false;
12138 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12143 LDKChannelManagerReadArgs this_ptr_conv;
12144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12145 this_ptr_conv.is_owned = false;
12146 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12147 if (val_conv.free == LDKWatch_JCalls_free) {
12148 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12149 LDKWatch_JCalls_clone(val_conv.this_arg);
12151 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
12155 LDKChannelManagerReadArgs this_ptr_conv;
12156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12157 this_ptr_conv.is_owned = false;
12158 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12163 LDKChannelManagerReadArgs this_ptr_conv;
12164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12165 this_ptr_conv.is_owned = false;
12166 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12167 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
12168 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12169 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
12171 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
12175 LDKChannelManagerReadArgs this_ptr_conv;
12176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12177 this_ptr_conv.is_owned = false;
12178 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12183 LDKChannelManagerReadArgs this_ptr_conv;
12184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12185 this_ptr_conv.is_owned = false;
12186 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12187 if (val_conv.free == LDKLogger_JCalls_free) {
12188 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12189 LDKLogger_JCalls_clone(val_conv.this_arg);
12191 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
12195 LDKChannelManagerReadArgs this_ptr_conv;
12196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12197 this_ptr_conv.is_owned = false;
12198 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12201 long ret_ref = (long)ret_var.inner;
12202 if (ret_var.is_owned) {
12208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12209 LDKChannelManagerReadArgs this_ptr_conv;
12210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12211 this_ptr_conv.is_owned = false;
12212 LDKUserConfig val_conv;
12213 val_conv.inner = (void*)(val & (~1));
12214 val_conv.is_owned = (val & 1) || (val == 0);
12215 val_conv = UserConfig_clone(&val_conv);
12216 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12219 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) {
12220 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12221 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12223 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12225 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12226 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
12227 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12228 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
12230 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12231 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12232 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12233 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12235 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12236 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12237 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12238 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12240 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12241 if (logger_conv.free == LDKLogger_JCalls_free) {
12242 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12243 LDKLogger_JCalls_clone(logger_conv.this_arg);
12245 LDKUserConfig default_config_conv;
12246 default_config_conv.inner = (void*)(default_config & (~1));
12247 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12248 default_config_conv = UserConfig_clone(&default_config_conv);
12249 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12250 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
12251 if (channel_monitors_constr.datalen > 0)
12252 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12254 channel_monitors_constr.data = NULL;
12255 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
12256 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12257 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
12258 LDKChannelMonitor channel_monitors_conv_16_conv;
12259 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12260 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12261 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12263 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
12264 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);
12265 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12266 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12267 long ret_ref = (long)ret_var.inner;
12268 if (ret_var.is_owned) {
12274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
12275 LDKu8slice ser_ref;
12276 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
12277 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
12278 LDKChannelManagerReadArgs arg_conv;
12279 arg_conv.inner = (void*)(arg & (~1));
12280 arg_conv.is_owned = (arg & 1) || (arg == 0);
12281 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12282 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12283 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12284 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
12285 return (long)ret_conv;
12288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12289 LDKDecodeError this_ptr_conv;
12290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12292 DecodeError_free(this_ptr_conv);
12295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12296 LDKDecodeError orig_conv;
12297 orig_conv.inner = (void*)(orig & (~1));
12298 orig_conv.is_owned = false;
12299 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12300 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12301 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12302 long ret_ref = (long)ret_var.inner;
12303 if (ret_var.is_owned) {
12309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12310 LDKInit this_ptr_conv;
12311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12313 Init_free(this_ptr_conv);
12316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
12317 LDKInit this_ptr_conv;
12318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12319 this_ptr_conv.is_owned = false;
12320 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12321 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12322 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12323 long ret_ref = (long)ret_var.inner;
12324 if (ret_var.is_owned) {
12330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12331 LDKInit this_ptr_conv;
12332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12333 this_ptr_conv.is_owned = false;
12334 LDKInitFeatures val_conv;
12335 val_conv.inner = (void*)(val & (~1));
12336 val_conv.is_owned = (val & 1) || (val == 0);
12337 val_conv = InitFeatures_clone(&val_conv);
12338 Init_set_features(&this_ptr_conv, val_conv);
12341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
12342 LDKInitFeatures features_arg_conv;
12343 features_arg_conv.inner = (void*)(features_arg & (~1));
12344 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12345 features_arg_conv = InitFeatures_clone(&features_arg_conv);
12346 LDKInit ret_var = Init_new(features_arg_conv);
12347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12349 long ret_ref = (long)ret_var.inner;
12350 if (ret_var.is_owned) {
12356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12358 orig_conv.inner = (void*)(orig & (~1));
12359 orig_conv.is_owned = false;
12360 LDKInit ret_var = Init_clone(&orig_conv);
12361 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12362 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12363 long ret_ref = (long)ret_var.inner;
12364 if (ret_var.is_owned) {
12370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12371 LDKErrorMessage this_ptr_conv;
12372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12374 ErrorMessage_free(this_ptr_conv);
12377 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12378 LDKErrorMessage this_ptr_conv;
12379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12380 this_ptr_conv.is_owned = false;
12381 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12382 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
12386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12387 LDKErrorMessage this_ptr_conv;
12388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12389 this_ptr_conv.is_owned = false;
12390 LDKThirtyTwoBytes val_ref;
12391 CHECK((*env)->GetArrayLength(env, val) == 32);
12392 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12393 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
12396 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
12397 LDKErrorMessage this_ptr_conv;
12398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12399 this_ptr_conv.is_owned = false;
12400 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
12401 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12406 LDKErrorMessage this_ptr_conv;
12407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12408 this_ptr_conv.is_owned = false;
12409 LDKCVec_u8Z val_ref;
12410 val_ref.datalen = (*env)->GetArrayLength(env, val);
12411 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12412 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12413 ErrorMessage_set_data(&this_ptr_conv, val_ref);
12416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
12417 LDKThirtyTwoBytes channel_id_arg_ref;
12418 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12419 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12420 LDKCVec_u8Z data_arg_ref;
12421 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
12422 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12423 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
12424 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
12425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12427 long ret_ref = (long)ret_var.inner;
12428 if (ret_var.is_owned) {
12434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12435 LDKErrorMessage orig_conv;
12436 orig_conv.inner = (void*)(orig & (~1));
12437 orig_conv.is_owned = false;
12438 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
12439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12441 long ret_ref = (long)ret_var.inner;
12442 if (ret_var.is_owned) {
12448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12449 LDKPing this_ptr_conv;
12450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12452 Ping_free(this_ptr_conv);
12455 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12456 LDKPing this_ptr_conv;
12457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12458 this_ptr_conv.is_owned = false;
12459 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
12463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12464 LDKPing this_ptr_conv;
12465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12466 this_ptr_conv.is_owned = false;
12467 Ping_set_ponglen(&this_ptr_conv, val);
12470 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12471 LDKPing this_ptr_conv;
12472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12473 this_ptr_conv.is_owned = false;
12474 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
12478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12479 LDKPing this_ptr_conv;
12480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12481 this_ptr_conv.is_owned = false;
12482 Ping_set_byteslen(&this_ptr_conv, val);
12485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
12486 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
12487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12489 long ret_ref = (long)ret_var.inner;
12490 if (ret_var.is_owned) {
12496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12498 orig_conv.inner = (void*)(orig & (~1));
12499 orig_conv.is_owned = false;
12500 LDKPing ret_var = Ping_clone(&orig_conv);
12501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12503 long ret_ref = (long)ret_var.inner;
12504 if (ret_var.is_owned) {
12510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12511 LDKPong this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12514 Pong_free(this_ptr_conv);
12517 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12518 LDKPong this_ptr_conv;
12519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12520 this_ptr_conv.is_owned = false;
12521 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
12525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12526 LDKPong this_ptr_conv;
12527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12528 this_ptr_conv.is_owned = false;
12529 Pong_set_byteslen(&this_ptr_conv, val);
12532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
12533 LDKPong ret_var = Pong_new(byteslen_arg);
12534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12536 long ret_ref = (long)ret_var.inner;
12537 if (ret_var.is_owned) {
12543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12545 orig_conv.inner = (void*)(orig & (~1));
12546 orig_conv.is_owned = false;
12547 LDKPong ret_var = Pong_clone(&orig_conv);
12548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12550 long ret_ref = (long)ret_var.inner;
12551 if (ret_var.is_owned) {
12557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12558 LDKOpenChannel this_ptr_conv;
12559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12561 OpenChannel_free(this_ptr_conv);
12564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12565 LDKOpenChannel this_ptr_conv;
12566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12567 this_ptr_conv.is_owned = false;
12568 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12569 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
12573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12574 LDKOpenChannel this_ptr_conv;
12575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12576 this_ptr_conv.is_owned = false;
12577 LDKThirtyTwoBytes val_ref;
12578 CHECK((*env)->GetArrayLength(env, val) == 32);
12579 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12580 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
12583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12584 LDKOpenChannel this_ptr_conv;
12585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12586 this_ptr_conv.is_owned = false;
12587 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12588 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
12592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12593 LDKOpenChannel this_ptr_conv;
12594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12595 this_ptr_conv.is_owned = false;
12596 LDKThirtyTwoBytes val_ref;
12597 CHECK((*env)->GetArrayLength(env, val) == 32);
12598 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12599 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12603 LDKOpenChannel this_ptr_conv;
12604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12605 this_ptr_conv.is_owned = false;
12606 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12611 LDKOpenChannel this_ptr_conv;
12612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12613 this_ptr_conv.is_owned = false;
12614 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12618 LDKOpenChannel this_ptr_conv;
12619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12620 this_ptr_conv.is_owned = false;
12621 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12626 LDKOpenChannel this_ptr_conv;
12627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12628 this_ptr_conv.is_owned = false;
12629 OpenChannel_set_push_msat(&this_ptr_conv, val);
12632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12633 LDKOpenChannel this_ptr_conv;
12634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12635 this_ptr_conv.is_owned = false;
12636 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12641 LDKOpenChannel this_ptr_conv;
12642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12643 this_ptr_conv.is_owned = false;
12644 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12647 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) {
12648 LDKOpenChannel this_ptr_conv;
12649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12650 this_ptr_conv.is_owned = false;
12651 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12655 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) {
12656 LDKOpenChannel this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = false;
12659 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12663 LDKOpenChannel this_ptr_conv;
12664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12665 this_ptr_conv.is_owned = false;
12666 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12671 LDKOpenChannel this_ptr_conv;
12672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12673 this_ptr_conv.is_owned = false;
12674 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12678 LDKOpenChannel this_ptr_conv;
12679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12680 this_ptr_conv.is_owned = false;
12681 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
12685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12686 LDKOpenChannel this_ptr_conv;
12687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12688 this_ptr_conv.is_owned = false;
12689 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12692 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
12693 LDKOpenChannel this_ptr_conv;
12694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12695 this_ptr_conv.is_owned = false;
12696 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
12700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12701 LDKOpenChannel this_ptr_conv;
12702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12703 this_ptr_conv.is_owned = false;
12704 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
12707 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
12708 LDKOpenChannel this_ptr_conv;
12709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12710 this_ptr_conv.is_owned = false;
12711 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
12715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12716 LDKOpenChannel this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = false;
12719 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
12722 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
12723 LDKOpenChannel this_ptr_conv;
12724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12725 this_ptr_conv.is_owned = false;
12726 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
12730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12731 LDKOpenChannel this_ptr_conv;
12732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12733 this_ptr_conv.is_owned = false;
12734 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
12738 LDKOpenChannel this_ptr_conv;
12739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12740 this_ptr_conv.is_owned = false;
12741 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12742 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
12746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12747 LDKOpenChannel this_ptr_conv;
12748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12749 this_ptr_conv.is_owned = false;
12750 LDKPublicKey val_ref;
12751 CHECK((*env)->GetArrayLength(env, val) == 33);
12752 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12753 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12757 LDKOpenChannel this_ptr_conv;
12758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12759 this_ptr_conv.is_owned = false;
12760 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12766 LDKOpenChannel this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = false;
12769 LDKPublicKey val_ref;
12770 CHECK((*env)->GetArrayLength(env, val) == 33);
12771 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12772 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
12776 LDKOpenChannel this_ptr_conv;
12777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12778 this_ptr_conv.is_owned = false;
12779 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12780 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
12784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12785 LDKOpenChannel this_ptr_conv;
12786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12787 this_ptr_conv.is_owned = false;
12788 LDKPublicKey val_ref;
12789 CHECK((*env)->GetArrayLength(env, val) == 33);
12790 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12791 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
12794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12795 LDKOpenChannel this_ptr_conv;
12796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12797 this_ptr_conv.is_owned = false;
12798 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12799 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12804 LDKOpenChannel this_ptr_conv;
12805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12806 this_ptr_conv.is_owned = false;
12807 LDKPublicKey val_ref;
12808 CHECK((*env)->GetArrayLength(env, val) == 33);
12809 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12810 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12814 LDKOpenChannel this_ptr_conv;
12815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12816 this_ptr_conv.is_owned = false;
12817 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12818 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12823 LDKOpenChannel this_ptr_conv;
12824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12825 this_ptr_conv.is_owned = false;
12826 LDKPublicKey val_ref;
12827 CHECK((*env)->GetArrayLength(env, val) == 33);
12828 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12829 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
12833 LDKOpenChannel this_ptr_conv;
12834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12835 this_ptr_conv.is_owned = false;
12836 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12837 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
12841 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) {
12842 LDKOpenChannel this_ptr_conv;
12843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12844 this_ptr_conv.is_owned = false;
12845 LDKPublicKey val_ref;
12846 CHECK((*env)->GetArrayLength(env, val) == 33);
12847 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12848 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12851 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
12852 LDKOpenChannel this_ptr_conv;
12853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12854 this_ptr_conv.is_owned = false;
12855 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
12859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
12860 LDKOpenChannel this_ptr_conv;
12861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12862 this_ptr_conv.is_owned = false;
12863 OpenChannel_set_channel_flags(&this_ptr_conv, val);
12866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12867 LDKOpenChannel orig_conv;
12868 orig_conv.inner = (void*)(orig & (~1));
12869 orig_conv.is_owned = false;
12870 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
12871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12873 long ret_ref = (long)ret_var.inner;
12874 if (ret_var.is_owned) {
12880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12881 LDKAcceptChannel this_ptr_conv;
12882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12884 AcceptChannel_free(this_ptr_conv);
12887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12888 LDKAcceptChannel this_ptr_conv;
12889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12890 this_ptr_conv.is_owned = false;
12891 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
12896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12897 LDKAcceptChannel this_ptr_conv;
12898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12899 this_ptr_conv.is_owned = false;
12900 LDKThirtyTwoBytes val_ref;
12901 CHECK((*env)->GetArrayLength(env, val) == 32);
12902 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12903 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12907 LDKAcceptChannel this_ptr_conv;
12908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12909 this_ptr_conv.is_owned = false;
12910 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12915 LDKAcceptChannel this_ptr_conv;
12916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12917 this_ptr_conv.is_owned = false;
12918 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12921 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) {
12922 LDKAcceptChannel this_ptr_conv;
12923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12924 this_ptr_conv.is_owned = false;
12925 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12929 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) {
12930 LDKAcceptChannel this_ptr_conv;
12931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12932 this_ptr_conv.is_owned = false;
12933 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12937 LDKAcceptChannel this_ptr_conv;
12938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12939 this_ptr_conv.is_owned = false;
12940 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12945 LDKAcceptChannel this_ptr_conv;
12946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12947 this_ptr_conv.is_owned = false;
12948 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12952 LDKAcceptChannel this_ptr_conv;
12953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12954 this_ptr_conv.is_owned = false;
12955 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12960 LDKAcceptChannel this_ptr_conv;
12961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12962 this_ptr_conv.is_owned = false;
12963 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12966 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
12967 LDKAcceptChannel this_ptr_conv;
12968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12969 this_ptr_conv.is_owned = false;
12970 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12975 LDKAcceptChannel this_ptr_conv;
12976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12977 this_ptr_conv.is_owned = false;
12978 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12981 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
12982 LDKAcceptChannel this_ptr_conv;
12983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12984 this_ptr_conv.is_owned = false;
12985 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12990 LDKAcceptChannel this_ptr_conv;
12991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12992 this_ptr_conv.is_owned = false;
12993 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12996 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
12997 LDKAcceptChannel this_ptr_conv;
12998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12999 this_ptr_conv.is_owned = false;
13000 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
13004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13005 LDKAcceptChannel this_ptr_conv;
13006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13007 this_ptr_conv.is_owned = false;
13008 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13012 LDKAcceptChannel this_ptr_conv;
13013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13014 this_ptr_conv.is_owned = false;
13015 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13016 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13021 LDKAcceptChannel this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = false;
13024 LDKPublicKey val_ref;
13025 CHECK((*env)->GetArrayLength(env, val) == 33);
13026 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13027 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13031 LDKAcceptChannel this_ptr_conv;
13032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13033 this_ptr_conv.is_owned = false;
13034 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13040 LDKAcceptChannel this_ptr_conv;
13041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13042 this_ptr_conv.is_owned = false;
13043 LDKPublicKey val_ref;
13044 CHECK((*env)->GetArrayLength(env, val) == 33);
13045 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13046 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13050 LDKAcceptChannel this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = false;
13053 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13054 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
13058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13059 LDKAcceptChannel this_ptr_conv;
13060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13061 this_ptr_conv.is_owned = false;
13062 LDKPublicKey val_ref;
13063 CHECK((*env)->GetArrayLength(env, val) == 33);
13064 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13065 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
13068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13069 LDKAcceptChannel this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = false;
13072 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13073 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13078 LDKAcceptChannel this_ptr_conv;
13079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13080 this_ptr_conv.is_owned = false;
13081 LDKPublicKey val_ref;
13082 CHECK((*env)->GetArrayLength(env, val) == 33);
13083 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13084 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13088 LDKAcceptChannel this_ptr_conv;
13089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13090 this_ptr_conv.is_owned = false;
13091 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13092 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13097 LDKAcceptChannel this_ptr_conv;
13098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13099 this_ptr_conv.is_owned = false;
13100 LDKPublicKey val_ref;
13101 CHECK((*env)->GetArrayLength(env, val) == 33);
13102 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13103 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13107 LDKAcceptChannel this_ptr_conv;
13108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13109 this_ptr_conv.is_owned = false;
13110 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13111 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13115 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) {
13116 LDKAcceptChannel this_ptr_conv;
13117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13118 this_ptr_conv.is_owned = false;
13119 LDKPublicKey val_ref;
13120 CHECK((*env)->GetArrayLength(env, val) == 33);
13121 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13122 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13126 LDKAcceptChannel orig_conv;
13127 orig_conv.inner = (void*)(orig & (~1));
13128 orig_conv.is_owned = false;
13129 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13130 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13131 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13132 long ret_ref = (long)ret_var.inner;
13133 if (ret_var.is_owned) {
13139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13140 LDKFundingCreated this_ptr_conv;
13141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13143 FundingCreated_free(this_ptr_conv);
13146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13147 LDKFundingCreated this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = false;
13150 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13151 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
13155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13156 LDKFundingCreated this_ptr_conv;
13157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13158 this_ptr_conv.is_owned = false;
13159 LDKThirtyTwoBytes val_ref;
13160 CHECK((*env)->GetArrayLength(env, val) == 32);
13161 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13162 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
13166 LDKFundingCreated this_ptr_conv;
13167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13168 this_ptr_conv.is_owned = false;
13169 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13170 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
13174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13175 LDKFundingCreated this_ptr_conv;
13176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13177 this_ptr_conv.is_owned = false;
13178 LDKThirtyTwoBytes val_ref;
13179 CHECK((*env)->GetArrayLength(env, val) == 32);
13180 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13181 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13184 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
13185 LDKFundingCreated this_ptr_conv;
13186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13187 this_ptr_conv.is_owned = false;
13188 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13193 LDKFundingCreated this_ptr_conv;
13194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13195 this_ptr_conv.is_owned = false;
13196 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13200 LDKFundingCreated this_ptr_conv;
13201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13202 this_ptr_conv.is_owned = false;
13203 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
13208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13209 LDKFundingCreated this_ptr_conv;
13210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13211 this_ptr_conv.is_owned = false;
13212 LDKSignature val_ref;
13213 CHECK((*env)->GetArrayLength(env, val) == 64);
13214 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13215 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13218 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) {
13219 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13220 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
13221 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
13222 LDKThirtyTwoBytes funding_txid_arg_ref;
13223 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
13224 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
13225 LDKSignature signature_arg_ref;
13226 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13227 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13228 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
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 int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13239 LDKFundingCreated orig_conv;
13240 orig_conv.inner = (void*)(orig & (~1));
13241 orig_conv.is_owned = false;
13242 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13243 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13244 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13245 long ret_ref = (long)ret_var.inner;
13246 if (ret_var.is_owned) {
13252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13253 LDKFundingSigned this_ptr_conv;
13254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13256 FundingSigned_free(this_ptr_conv);
13259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13260 LDKFundingSigned this_ptr_conv;
13261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13262 this_ptr_conv.is_owned = false;
13263 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13264 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
13268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13269 LDKFundingSigned this_ptr_conv;
13270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13271 this_ptr_conv.is_owned = false;
13272 LDKThirtyTwoBytes val_ref;
13273 CHECK((*env)->GetArrayLength(env, val) == 32);
13274 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13275 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13279 LDKFundingSigned this_ptr_conv;
13280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13281 this_ptr_conv.is_owned = false;
13282 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13283 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
13287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13288 LDKFundingSigned this_ptr_conv;
13289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13290 this_ptr_conv.is_owned = false;
13291 LDKSignature val_ref;
13292 CHECK((*env)->GetArrayLength(env, val) == 64);
13293 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13294 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
13298 LDKThirtyTwoBytes channel_id_arg_ref;
13299 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13300 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13301 LDKSignature signature_arg_ref;
13302 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13303 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13304 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13305 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13306 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13307 long ret_ref = (long)ret_var.inner;
13308 if (ret_var.is_owned) {
13314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13315 LDKFundingSigned orig_conv;
13316 orig_conv.inner = (void*)(orig & (~1));
13317 orig_conv.is_owned = false;
13318 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13319 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13320 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13321 long ret_ref = (long)ret_var.inner;
13322 if (ret_var.is_owned) {
13328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13329 LDKFundingLocked this_ptr_conv;
13330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13332 FundingLocked_free(this_ptr_conv);
13335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13336 LDKFundingLocked this_ptr_conv;
13337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13338 this_ptr_conv.is_owned = false;
13339 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13340 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
13344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13345 LDKFundingLocked this_ptr_conv;
13346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13347 this_ptr_conv.is_owned = false;
13348 LDKThirtyTwoBytes val_ref;
13349 CHECK((*env)->GetArrayLength(env, val) == 32);
13350 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13351 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
13354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13355 LDKFundingLocked this_ptr_conv;
13356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13357 this_ptr_conv.is_owned = false;
13358 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
13363 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) {
13364 LDKFundingLocked this_ptr_conv;
13365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13366 this_ptr_conv.is_owned = false;
13367 LDKPublicKey val_ref;
13368 CHECK((*env)->GetArrayLength(env, val) == 33);
13369 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13370 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13373 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) {
13374 LDKThirtyTwoBytes channel_id_arg_ref;
13375 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13376 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13377 LDKPublicKey next_per_commitment_point_arg_ref;
13378 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
13379 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
13380 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
13381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13383 long ret_ref = (long)ret_var.inner;
13384 if (ret_var.is_owned) {
13390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13391 LDKFundingLocked orig_conv;
13392 orig_conv.inner = (void*)(orig & (~1));
13393 orig_conv.is_owned = false;
13394 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
13395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13397 long ret_ref = (long)ret_var.inner;
13398 if (ret_var.is_owned) {
13404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13405 LDKShutdown this_ptr_conv;
13406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13408 Shutdown_free(this_ptr_conv);
13411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13412 LDKShutdown this_ptr_conv;
13413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13414 this_ptr_conv.is_owned = false;
13415 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
13420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13421 LDKShutdown this_ptr_conv;
13422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13423 this_ptr_conv.is_owned = false;
13424 LDKThirtyTwoBytes val_ref;
13425 CHECK((*env)->GetArrayLength(env, val) == 32);
13426 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13427 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
13430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13431 LDKShutdown this_ptr_conv;
13432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13433 this_ptr_conv.is_owned = false;
13434 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
13435 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13436 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13441 LDKShutdown this_ptr_conv;
13442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13443 this_ptr_conv.is_owned = false;
13444 LDKCVec_u8Z val_ref;
13445 val_ref.datalen = (*env)->GetArrayLength(env, val);
13446 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13447 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13448 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
13451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
13452 LDKThirtyTwoBytes channel_id_arg_ref;
13453 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13454 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13455 LDKCVec_u8Z scriptpubkey_arg_ref;
13456 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
13457 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13458 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
13459 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
13460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13462 long ret_ref = (long)ret_var.inner;
13463 if (ret_var.is_owned) {
13469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13470 LDKShutdown orig_conv;
13471 orig_conv.inner = (void*)(orig & (~1));
13472 orig_conv.is_owned = false;
13473 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
13474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13476 long ret_ref = (long)ret_var.inner;
13477 if (ret_var.is_owned) {
13483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13484 LDKClosingSigned this_ptr_conv;
13485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13487 ClosingSigned_free(this_ptr_conv);
13490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13491 LDKClosingSigned this_ptr_conv;
13492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13493 this_ptr_conv.is_owned = false;
13494 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13495 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
13499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13500 LDKClosingSigned this_ptr_conv;
13501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13502 this_ptr_conv.is_owned = false;
13503 LDKThirtyTwoBytes val_ref;
13504 CHECK((*env)->GetArrayLength(env, val) == 32);
13505 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13506 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
13509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13510 LDKClosingSigned this_ptr_conv;
13511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13512 this_ptr_conv.is_owned = false;
13513 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
13517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13518 LDKClosingSigned this_ptr_conv;
13519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13520 this_ptr_conv.is_owned = false;
13521 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
13524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13525 LDKClosingSigned this_ptr_conv;
13526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13527 this_ptr_conv.is_owned = false;
13528 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
13533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13534 LDKClosingSigned this_ptr_conv;
13535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13536 this_ptr_conv.is_owned = false;
13537 LDKSignature val_ref;
13538 CHECK((*env)->GetArrayLength(env, val) == 64);
13539 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13540 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
13543 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) {
13544 LDKThirtyTwoBytes channel_id_arg_ref;
13545 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13546 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13547 LDKSignature signature_arg_ref;
13548 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13549 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13550 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
13551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13553 long ret_ref = (long)ret_var.inner;
13554 if (ret_var.is_owned) {
13560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13561 LDKClosingSigned orig_conv;
13562 orig_conv.inner = (void*)(orig & (~1));
13563 orig_conv.is_owned = false;
13564 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
13565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13567 long ret_ref = (long)ret_var.inner;
13568 if (ret_var.is_owned) {
13574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13575 LDKUpdateAddHTLC this_ptr_conv;
13576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13578 UpdateAddHTLC_free(this_ptr_conv);
13581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13582 LDKUpdateAddHTLC this_ptr_conv;
13583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13584 this_ptr_conv.is_owned = false;
13585 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13586 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
13590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13591 LDKUpdateAddHTLC this_ptr_conv;
13592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13593 this_ptr_conv.is_owned = false;
13594 LDKThirtyTwoBytes val_ref;
13595 CHECK((*env)->GetArrayLength(env, val) == 32);
13596 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13597 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
13600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13601 LDKUpdateAddHTLC this_ptr_conv;
13602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13603 this_ptr_conv.is_owned = false;
13604 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13609 LDKUpdateAddHTLC this_ptr_conv;
13610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13611 this_ptr_conv.is_owned = false;
13612 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13616 LDKUpdateAddHTLC this_ptr_conv;
13617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13618 this_ptr_conv.is_owned = false;
13619 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13624 LDKUpdateAddHTLC this_ptr_conv;
13625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13626 this_ptr_conv.is_owned = false;
13627 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13631 LDKUpdateAddHTLC this_ptr_conv;
13632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13633 this_ptr_conv.is_owned = false;
13634 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13635 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
13639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13640 LDKUpdateAddHTLC this_ptr_conv;
13641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13642 this_ptr_conv.is_owned = false;
13643 LDKThirtyTwoBytes val_ref;
13644 CHECK((*env)->GetArrayLength(env, val) == 32);
13645 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13646 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13649 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
13650 LDKUpdateAddHTLC this_ptr_conv;
13651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13652 this_ptr_conv.is_owned = false;
13653 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13658 LDKUpdateAddHTLC this_ptr_conv;
13659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13660 this_ptr_conv.is_owned = false;
13661 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
13664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13665 LDKUpdateAddHTLC orig_conv;
13666 orig_conv.inner = (void*)(orig & (~1));
13667 orig_conv.is_owned = false;
13668 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
13669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13671 long ret_ref = (long)ret_var.inner;
13672 if (ret_var.is_owned) {
13678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13679 LDKUpdateFulfillHTLC this_ptr_conv;
13680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13682 UpdateFulfillHTLC_free(this_ptr_conv);
13685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13686 LDKUpdateFulfillHTLC 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, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
13694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13695 LDKUpdateFulfillHTLC 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 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
13704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13705 LDKUpdateFulfillHTLC this_ptr_conv;
13706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13707 this_ptr_conv.is_owned = false;
13708 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
13712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13713 LDKUpdateFulfillHTLC this_ptr_conv;
13714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13715 this_ptr_conv.is_owned = false;
13716 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
13719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
13720 LDKUpdateFulfillHTLC this_ptr_conv;
13721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13722 this_ptr_conv.is_owned = false;
13723 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
13728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13729 LDKUpdateFulfillHTLC this_ptr_conv;
13730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13731 this_ptr_conv.is_owned = false;
13732 LDKThirtyTwoBytes val_ref;
13733 CHECK((*env)->GetArrayLength(env, val) == 32);
13734 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13735 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
13738 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) {
13739 LDKThirtyTwoBytes channel_id_arg_ref;
13740 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13741 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13742 LDKThirtyTwoBytes payment_preimage_arg_ref;
13743 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
13744 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
13745 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
13746 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13747 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13748 long ret_ref = (long)ret_var.inner;
13749 if (ret_var.is_owned) {
13755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13756 LDKUpdateFulfillHTLC orig_conv;
13757 orig_conv.inner = (void*)(orig & (~1));
13758 orig_conv.is_owned = false;
13759 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
13760 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13761 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13762 long ret_ref = (long)ret_var.inner;
13763 if (ret_var.is_owned) {
13769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13770 LDKUpdateFailHTLC this_ptr_conv;
13771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13773 UpdateFailHTLC_free(this_ptr_conv);
13776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13777 LDKUpdateFailHTLC this_ptr_conv;
13778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13779 this_ptr_conv.is_owned = false;
13780 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
13785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13786 LDKUpdateFailHTLC this_ptr_conv;
13787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13788 this_ptr_conv.is_owned = false;
13789 LDKThirtyTwoBytes val_ref;
13790 CHECK((*env)->GetArrayLength(env, val) == 32);
13791 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13792 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
13795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13796 LDKUpdateFailHTLC this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = false;
13799 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
13803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13804 LDKUpdateFailHTLC this_ptr_conv;
13805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13806 this_ptr_conv.is_owned = false;
13807 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
13810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13811 LDKUpdateFailHTLC orig_conv;
13812 orig_conv.inner = (void*)(orig & (~1));
13813 orig_conv.is_owned = false;
13814 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
13815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13817 long ret_ref = (long)ret_var.inner;
13818 if (ret_var.is_owned) {
13824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13825 LDKUpdateFailMalformedHTLC this_ptr_conv;
13826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13828 UpdateFailMalformedHTLC_free(this_ptr_conv);
13831 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13832 LDKUpdateFailMalformedHTLC this_ptr_conv;
13833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13834 this_ptr_conv.is_owned = false;
13835 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13836 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
13840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13841 LDKUpdateFailMalformedHTLC this_ptr_conv;
13842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13843 this_ptr_conv.is_owned = false;
13844 LDKThirtyTwoBytes val_ref;
13845 CHECK((*env)->GetArrayLength(env, val) == 32);
13846 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13847 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
13850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13851 LDKUpdateFailMalformedHTLC this_ptr_conv;
13852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13853 this_ptr_conv.is_owned = false;
13854 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
13858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13859 LDKUpdateFailMalformedHTLC this_ptr_conv;
13860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13861 this_ptr_conv.is_owned = false;
13862 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
13865 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
13866 LDKUpdateFailMalformedHTLC this_ptr_conv;
13867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13868 this_ptr_conv.is_owned = false;
13869 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
13873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13874 LDKUpdateFailMalformedHTLC this_ptr_conv;
13875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13876 this_ptr_conv.is_owned = false;
13877 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13881 LDKUpdateFailMalformedHTLC orig_conv;
13882 orig_conv.inner = (void*)(orig & (~1));
13883 orig_conv.is_owned = false;
13884 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
13885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13887 long ret_ref = (long)ret_var.inner;
13888 if (ret_var.is_owned) {
13894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13895 LDKCommitmentSigned this_ptr_conv;
13896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13898 CommitmentSigned_free(this_ptr_conv);
13901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13902 LDKCommitmentSigned this_ptr_conv;
13903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13904 this_ptr_conv.is_owned = false;
13905 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13906 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
13910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13911 LDKCommitmentSigned this_ptr_conv;
13912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13913 this_ptr_conv.is_owned = false;
13914 LDKThirtyTwoBytes val_ref;
13915 CHECK((*env)->GetArrayLength(env, val) == 32);
13916 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13917 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13921 LDKCommitmentSigned this_ptr_conv;
13922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13923 this_ptr_conv.is_owned = false;
13924 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13925 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
13929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13930 LDKCommitmentSigned this_ptr_conv;
13931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13932 this_ptr_conv.is_owned = false;
13933 LDKSignature val_ref;
13934 CHECK((*env)->GetArrayLength(env, val) == 64);
13935 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13936 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
13940 LDKCommitmentSigned this_ptr_conv;
13941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13942 this_ptr_conv.is_owned = false;
13943 LDKCVec_SignatureZ val_constr;
13944 val_constr.datalen = (*env)->GetArrayLength(env, val);
13945 if (val_constr.datalen > 0)
13946 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13948 val_constr.data = NULL;
13949 for (size_t i = 0; i < val_constr.datalen; i++) {
13950 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
13951 LDKSignature val_conv_8_ref;
13952 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
13953 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
13954 val_constr.data[i] = val_conv_8_ref;
13956 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13959 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) {
13960 LDKThirtyTwoBytes channel_id_arg_ref;
13961 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13962 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13963 LDKSignature signature_arg_ref;
13964 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13965 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13966 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13967 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
13968 if (htlc_signatures_arg_constr.datalen > 0)
13969 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13971 htlc_signatures_arg_constr.data = NULL;
13972 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
13973 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
13974 LDKSignature htlc_signatures_arg_conv_8_ref;
13975 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
13976 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
13977 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
13979 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13980 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13981 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13982 long ret_ref = (long)ret_var.inner;
13983 if (ret_var.is_owned) {
13989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13990 LDKCommitmentSigned orig_conv;
13991 orig_conv.inner = (void*)(orig & (~1));
13992 orig_conv.is_owned = false;
13993 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13994 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13995 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13996 long ret_ref = (long)ret_var.inner;
13997 if (ret_var.is_owned) {
14003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14004 LDKRevokeAndACK this_ptr_conv;
14005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14007 RevokeAndACK_free(this_ptr_conv);
14010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14011 LDKRevokeAndACK this_ptr_conv;
14012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14013 this_ptr_conv.is_owned = false;
14014 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
14019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14020 LDKRevokeAndACK this_ptr_conv;
14021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14022 this_ptr_conv.is_owned = false;
14023 LDKThirtyTwoBytes val_ref;
14024 CHECK((*env)->GetArrayLength(env, val) == 32);
14025 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14026 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
14029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14030 LDKRevokeAndACK this_ptr_conv;
14031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14032 this_ptr_conv.is_owned = false;
14033 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
14038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14039 LDKRevokeAndACK this_ptr_conv;
14040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14041 this_ptr_conv.is_owned = false;
14042 LDKThirtyTwoBytes val_ref;
14043 CHECK((*env)->GetArrayLength(env, val) == 32);
14044 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14045 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
14048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14049 LDKRevokeAndACK this_ptr_conv;
14050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14051 this_ptr_conv.is_owned = false;
14052 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14053 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
14057 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) {
14058 LDKRevokeAndACK this_ptr_conv;
14059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14060 this_ptr_conv.is_owned = false;
14061 LDKPublicKey val_ref;
14062 CHECK((*env)->GetArrayLength(env, val) == 33);
14063 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14064 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
14067 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) {
14068 LDKThirtyTwoBytes channel_id_arg_ref;
14069 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14070 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14071 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
14072 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
14073 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
14074 LDKPublicKey next_per_commitment_point_arg_ref;
14075 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
14076 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
14077 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
14078 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14079 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14080 long ret_ref = (long)ret_var.inner;
14081 if (ret_var.is_owned) {
14087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14088 LDKRevokeAndACK orig_conv;
14089 orig_conv.inner = (void*)(orig & (~1));
14090 orig_conv.is_owned = false;
14091 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
14092 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14093 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14094 long ret_ref = (long)ret_var.inner;
14095 if (ret_var.is_owned) {
14101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14102 LDKUpdateFee this_ptr_conv;
14103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14105 UpdateFee_free(this_ptr_conv);
14108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14109 LDKUpdateFee this_ptr_conv;
14110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14111 this_ptr_conv.is_owned = false;
14112 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
14117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14118 LDKUpdateFee this_ptr_conv;
14119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14120 this_ptr_conv.is_owned = false;
14121 LDKThirtyTwoBytes val_ref;
14122 CHECK((*env)->GetArrayLength(env, val) == 32);
14123 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14124 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14127 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
14128 LDKUpdateFee this_ptr_conv;
14129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14130 this_ptr_conv.is_owned = false;
14131 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14136 LDKUpdateFee this_ptr_conv;
14137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14138 this_ptr_conv.is_owned = false;
14139 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14142 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) {
14143 LDKThirtyTwoBytes channel_id_arg_ref;
14144 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14145 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14146 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14147 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14148 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14149 long ret_ref = (long)ret_var.inner;
14150 if (ret_var.is_owned) {
14156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14157 LDKUpdateFee orig_conv;
14158 orig_conv.inner = (void*)(orig & (~1));
14159 orig_conv.is_owned = false;
14160 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14163 long ret_ref = (long)ret_var.inner;
14164 if (ret_var.is_owned) {
14170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14171 LDKDataLossProtect this_ptr_conv;
14172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14174 DataLossProtect_free(this_ptr_conv);
14177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14178 LDKDataLossProtect this_ptr_conv;
14179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14180 this_ptr_conv.is_owned = false;
14181 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
14186 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) {
14187 LDKDataLossProtect this_ptr_conv;
14188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14189 this_ptr_conv.is_owned = false;
14190 LDKThirtyTwoBytes val_ref;
14191 CHECK((*env)->GetArrayLength(env, val) == 32);
14192 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14193 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14197 LDKDataLossProtect this_ptr_conv;
14198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14199 this_ptr_conv.is_owned = false;
14200 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
14205 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) {
14206 LDKDataLossProtect this_ptr_conv;
14207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14208 this_ptr_conv.is_owned = false;
14209 LDKPublicKey val_ref;
14210 CHECK((*env)->GetArrayLength(env, val) == 33);
14211 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14212 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14215 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) {
14216 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14217 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
14218 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
14219 LDKPublicKey my_current_per_commitment_point_arg_ref;
14220 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
14221 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
14222 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14225 long ret_ref = (long)ret_var.inner;
14226 if (ret_var.is_owned) {
14232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14233 LDKDataLossProtect orig_conv;
14234 orig_conv.inner = (void*)(orig & (~1));
14235 orig_conv.is_owned = false;
14236 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14237 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14238 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14239 long ret_ref = (long)ret_var.inner;
14240 if (ret_var.is_owned) {
14246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14247 LDKChannelReestablish this_ptr_conv;
14248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14250 ChannelReestablish_free(this_ptr_conv);
14253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14254 LDKChannelReestablish this_ptr_conv;
14255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14256 this_ptr_conv.is_owned = false;
14257 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
14262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14263 LDKChannelReestablish this_ptr_conv;
14264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14265 this_ptr_conv.is_owned = false;
14266 LDKThirtyTwoBytes val_ref;
14267 CHECK((*env)->GetArrayLength(env, val) == 32);
14268 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14269 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14273 LDKChannelReestablish this_ptr_conv;
14274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14275 this_ptr_conv.is_owned = false;
14276 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14280 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) {
14281 LDKChannelReestablish this_ptr_conv;
14282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14283 this_ptr_conv.is_owned = false;
14284 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14288 LDKChannelReestablish this_ptr_conv;
14289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14290 this_ptr_conv.is_owned = false;
14291 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14295 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) {
14296 LDKChannelReestablish this_ptr_conv;
14297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14298 this_ptr_conv.is_owned = false;
14299 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14303 LDKChannelReestablish orig_conv;
14304 orig_conv.inner = (void*)(orig & (~1));
14305 orig_conv.is_owned = false;
14306 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14307 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14308 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14309 long ret_ref = (long)ret_var.inner;
14310 if (ret_var.is_owned) {
14316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14317 LDKAnnouncementSignatures this_ptr_conv;
14318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14320 AnnouncementSignatures_free(this_ptr_conv);
14323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14324 LDKAnnouncementSignatures this_ptr_conv;
14325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14326 this_ptr_conv.is_owned = false;
14327 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14328 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
14332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14333 LDKAnnouncementSignatures this_ptr_conv;
14334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14335 this_ptr_conv.is_owned = false;
14336 LDKThirtyTwoBytes val_ref;
14337 CHECK((*env)->GetArrayLength(env, val) == 32);
14338 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14339 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
14342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14343 LDKAnnouncementSignatures this_ptr_conv;
14344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14345 this_ptr_conv.is_owned = false;
14346 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
14350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14351 LDKAnnouncementSignatures this_ptr_conv;
14352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14353 this_ptr_conv.is_owned = false;
14354 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
14357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14358 LDKAnnouncementSignatures this_ptr_conv;
14359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14360 this_ptr_conv.is_owned = false;
14361 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
14366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14367 LDKAnnouncementSignatures this_ptr_conv;
14368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14369 this_ptr_conv.is_owned = false;
14370 LDKSignature val_ref;
14371 CHECK((*env)->GetArrayLength(env, val) == 64);
14372 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14373 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
14376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14377 LDKAnnouncementSignatures this_ptr_conv;
14378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14379 this_ptr_conv.is_owned = false;
14380 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14381 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
14385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14386 LDKAnnouncementSignatures this_ptr_conv;
14387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14388 this_ptr_conv.is_owned = false;
14389 LDKSignature val_ref;
14390 CHECK((*env)->GetArrayLength(env, val) == 64);
14391 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14392 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
14395 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) {
14396 LDKThirtyTwoBytes channel_id_arg_ref;
14397 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14398 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14399 LDKSignature node_signature_arg_ref;
14400 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
14401 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
14402 LDKSignature bitcoin_signature_arg_ref;
14403 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
14404 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
14405 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
14406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14408 long ret_ref = (long)ret_var.inner;
14409 if (ret_var.is_owned) {
14415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14416 LDKAnnouncementSignatures orig_conv;
14417 orig_conv.inner = (void*)(orig & (~1));
14418 orig_conv.is_owned = false;
14419 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
14420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14422 long ret_ref = (long)ret_var.inner;
14423 if (ret_var.is_owned) {
14429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14430 if ((this_ptr & 1) != 0) return;
14431 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
14432 FREE((void*)this_ptr);
14433 NetAddress_free(this_ptr_conv);
14436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14437 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
14438 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
14439 *ret_copy = NetAddress_clone(orig_conv);
14440 long ret_ref = (long)ret_copy;
14444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
14445 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
14446 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
14447 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14448 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14449 CVec_u8Z_free(ret_var);
14453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14454 LDKu8slice ser_ref;
14455 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14456 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14457 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14458 *ret_conv = Result_read(ser_ref);
14459 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14460 return (long)ret_conv;
14463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14464 LDKUnsignedNodeAnnouncement this_ptr_conv;
14465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14467 UnsignedNodeAnnouncement_free(this_ptr_conv);
14470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
14471 LDKUnsignedNodeAnnouncement this_ptr_conv;
14472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14473 this_ptr_conv.is_owned = false;
14474 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
14475 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14476 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14477 long ret_ref = (long)ret_var.inner;
14478 if (ret_var.is_owned) {
14484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14485 LDKUnsignedNodeAnnouncement this_ptr_conv;
14486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14487 this_ptr_conv.is_owned = false;
14488 LDKNodeFeatures val_conv;
14489 val_conv.inner = (void*)(val & (~1));
14490 val_conv.is_owned = (val & 1) || (val == 0);
14491 val_conv = NodeFeatures_clone(&val_conv);
14492 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
14495 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
14496 LDKUnsignedNodeAnnouncement this_ptr_conv;
14497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14498 this_ptr_conv.is_owned = false;
14499 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
14503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14504 LDKUnsignedNodeAnnouncement this_ptr_conv;
14505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14506 this_ptr_conv.is_owned = false;
14507 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
14510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14511 LDKUnsignedNodeAnnouncement this_ptr_conv;
14512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14513 this_ptr_conv.is_owned = false;
14514 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14515 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
14519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14520 LDKUnsignedNodeAnnouncement this_ptr_conv;
14521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14522 this_ptr_conv.is_owned = false;
14523 LDKPublicKey val_ref;
14524 CHECK((*env)->GetArrayLength(env, val) == 33);
14525 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14526 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
14529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
14530 LDKUnsignedNodeAnnouncement this_ptr_conv;
14531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14532 this_ptr_conv.is_owned = false;
14533 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
14534 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
14538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14539 LDKUnsignedNodeAnnouncement this_ptr_conv;
14540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14541 this_ptr_conv.is_owned = false;
14542 LDKThreeBytes val_ref;
14543 CHECK((*env)->GetArrayLength(env, val) == 3);
14544 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
14545 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
14548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
14549 LDKUnsignedNodeAnnouncement this_ptr_conv;
14550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14551 this_ptr_conv.is_owned = false;
14552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
14557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14558 LDKUnsignedNodeAnnouncement this_ptr_conv;
14559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14560 this_ptr_conv.is_owned = false;
14561 LDKThirtyTwoBytes val_ref;
14562 CHECK((*env)->GetArrayLength(env, val) == 32);
14563 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14564 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
14567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14568 LDKUnsignedNodeAnnouncement this_ptr_conv;
14569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14570 this_ptr_conv.is_owned = false;
14571 LDKCVec_NetAddressZ val_constr;
14572 val_constr.datalen = (*env)->GetArrayLength(env, val);
14573 if (val_constr.datalen > 0)
14574 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14576 val_constr.data = NULL;
14577 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14578 for (size_t m = 0; m < val_constr.datalen; m++) {
14579 int64_t val_conv_12 = val_vals[m];
14580 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
14581 FREE((void*)val_conv_12);
14582 val_constr.data[m] = val_conv_12_conv;
14584 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14585 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
14588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14589 LDKUnsignedNodeAnnouncement orig_conv;
14590 orig_conv.inner = (void*)(orig & (~1));
14591 orig_conv.is_owned = false;
14592 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
14593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14595 long ret_ref = (long)ret_var.inner;
14596 if (ret_var.is_owned) {
14602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14603 LDKNodeAnnouncement this_ptr_conv;
14604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14606 NodeAnnouncement_free(this_ptr_conv);
14609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14610 LDKNodeAnnouncement this_ptr_conv;
14611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14612 this_ptr_conv.is_owned = false;
14613 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14614 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
14618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14619 LDKNodeAnnouncement this_ptr_conv;
14620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14621 this_ptr_conv.is_owned = false;
14622 LDKSignature val_ref;
14623 CHECK((*env)->GetArrayLength(env, val) == 64);
14624 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14625 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14629 LDKNodeAnnouncement this_ptr_conv;
14630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14631 this_ptr_conv.is_owned = false;
14632 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14633 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14634 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14635 long ret_ref = (long)ret_var.inner;
14636 if (ret_var.is_owned) {
14642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14643 LDKNodeAnnouncement this_ptr_conv;
14644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14645 this_ptr_conv.is_owned = false;
14646 LDKUnsignedNodeAnnouncement val_conv;
14647 val_conv.inner = (void*)(val & (~1));
14648 val_conv.is_owned = (val & 1) || (val == 0);
14649 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14650 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
14654 LDKSignature signature_arg_ref;
14655 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14656 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14657 LDKUnsignedNodeAnnouncement contents_arg_conv;
14658 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14659 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14660 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
14661 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
14662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14664 long ret_ref = (long)ret_var.inner;
14665 if (ret_var.is_owned) {
14671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14672 LDKNodeAnnouncement orig_conv;
14673 orig_conv.inner = (void*)(orig & (~1));
14674 orig_conv.is_owned = false;
14675 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
14676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14678 long ret_ref = (long)ret_var.inner;
14679 if (ret_var.is_owned) {
14685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14686 LDKUnsignedChannelAnnouncement this_ptr_conv;
14687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14689 UnsignedChannelAnnouncement_free(this_ptr_conv);
14692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
14693 LDKUnsignedChannelAnnouncement this_ptr_conv;
14694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14695 this_ptr_conv.is_owned = false;
14696 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
14697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14699 long ret_ref = (long)ret_var.inner;
14700 if (ret_var.is_owned) {
14706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14707 LDKUnsignedChannelAnnouncement this_ptr_conv;
14708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14709 this_ptr_conv.is_owned = false;
14710 LDKChannelFeatures val_conv;
14711 val_conv.inner = (void*)(val & (~1));
14712 val_conv.is_owned = (val & 1) || (val == 0);
14713 val_conv = ChannelFeatures_clone(&val_conv);
14714 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
14717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14718 LDKUnsignedChannelAnnouncement this_ptr_conv;
14719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14720 this_ptr_conv.is_owned = false;
14721 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14722 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
14726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14727 LDKUnsignedChannelAnnouncement this_ptr_conv;
14728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14729 this_ptr_conv.is_owned = false;
14730 LDKThirtyTwoBytes val_ref;
14731 CHECK((*env)->GetArrayLength(env, val) == 32);
14732 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14733 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
14736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14737 LDKUnsignedChannelAnnouncement this_ptr_conv;
14738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14739 this_ptr_conv.is_owned = false;
14740 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
14744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14745 LDKUnsignedChannelAnnouncement this_ptr_conv;
14746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14747 this_ptr_conv.is_owned = false;
14748 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
14751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
14752 LDKUnsignedChannelAnnouncement this_ptr_conv;
14753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14754 this_ptr_conv.is_owned = false;
14755 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
14760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14761 LDKUnsignedChannelAnnouncement this_ptr_conv;
14762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14763 this_ptr_conv.is_owned = false;
14764 LDKPublicKey val_ref;
14765 CHECK((*env)->GetArrayLength(env, val) == 33);
14766 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14767 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
14770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14771 LDKUnsignedChannelAnnouncement this_ptr_conv;
14772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14773 this_ptr_conv.is_owned = false;
14774 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
14779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14780 LDKUnsignedChannelAnnouncement this_ptr_conv;
14781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14782 this_ptr_conv.is_owned = false;
14783 LDKPublicKey val_ref;
14784 CHECK((*env)->GetArrayLength(env, val) == 33);
14785 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14786 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
14789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
14790 LDKUnsignedChannelAnnouncement this_ptr_conv;
14791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14792 this_ptr_conv.is_owned = false;
14793 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14794 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
14798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14799 LDKUnsignedChannelAnnouncement this_ptr_conv;
14800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14801 this_ptr_conv.is_owned = false;
14802 LDKPublicKey val_ref;
14803 CHECK((*env)->GetArrayLength(env, val) == 33);
14804 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14805 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
14808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14809 LDKUnsignedChannelAnnouncement this_ptr_conv;
14810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14811 this_ptr_conv.is_owned = false;
14812 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
14817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14818 LDKUnsignedChannelAnnouncement this_ptr_conv;
14819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14820 this_ptr_conv.is_owned = false;
14821 LDKPublicKey val_ref;
14822 CHECK((*env)->GetArrayLength(env, val) == 33);
14823 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14824 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
14827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14828 LDKUnsignedChannelAnnouncement orig_conv;
14829 orig_conv.inner = (void*)(orig & (~1));
14830 orig_conv.is_owned = false;
14831 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
14832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14834 long ret_ref = (long)ret_var.inner;
14835 if (ret_var.is_owned) {
14841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14842 LDKChannelAnnouncement this_ptr_conv;
14843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14845 ChannelAnnouncement_free(this_ptr_conv);
14848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
14849 LDKChannelAnnouncement this_ptr_conv;
14850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14851 this_ptr_conv.is_owned = false;
14852 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
14857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14858 LDKChannelAnnouncement this_ptr_conv;
14859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14860 this_ptr_conv.is_owned = false;
14861 LDKSignature val_ref;
14862 CHECK((*env)->GetArrayLength(env, val) == 64);
14863 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14864 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
14867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14868 LDKChannelAnnouncement this_ptr_conv;
14869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14870 this_ptr_conv.is_owned = false;
14871 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14872 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
14876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14877 LDKChannelAnnouncement this_ptr_conv;
14878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14879 this_ptr_conv.is_owned = false;
14880 LDKSignature val_ref;
14881 CHECK((*env)->GetArrayLength(env, val) == 64);
14882 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14883 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
14887 LDKChannelAnnouncement this_ptr_conv;
14888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14889 this_ptr_conv.is_owned = false;
14890 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14891 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
14895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14896 LDKChannelAnnouncement this_ptr_conv;
14897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14898 this_ptr_conv.is_owned = false;
14899 LDKSignature val_ref;
14900 CHECK((*env)->GetArrayLength(env, val) == 64);
14901 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14902 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14906 LDKChannelAnnouncement this_ptr_conv;
14907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14908 this_ptr_conv.is_owned = false;
14909 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14910 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
14914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14915 LDKChannelAnnouncement this_ptr_conv;
14916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14917 this_ptr_conv.is_owned = false;
14918 LDKSignature val_ref;
14919 CHECK((*env)->GetArrayLength(env, val) == 64);
14920 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14921 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14925 LDKChannelAnnouncement this_ptr_conv;
14926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14927 this_ptr_conv.is_owned = false;
14928 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14929 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14930 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14931 long ret_ref = (long)ret_var.inner;
14932 if (ret_var.is_owned) {
14938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14939 LDKChannelAnnouncement this_ptr_conv;
14940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14941 this_ptr_conv.is_owned = false;
14942 LDKUnsignedChannelAnnouncement val_conv;
14943 val_conv.inner = (void*)(val & (~1));
14944 val_conv.is_owned = (val & 1) || (val == 0);
14945 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14946 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14949 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) {
14950 LDKSignature node_signature_1_arg_ref;
14951 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
14952 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
14953 LDKSignature node_signature_2_arg_ref;
14954 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
14955 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
14956 LDKSignature bitcoin_signature_1_arg_ref;
14957 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
14958 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
14959 LDKSignature bitcoin_signature_2_arg_ref;
14960 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
14961 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
14962 LDKUnsignedChannelAnnouncement contents_arg_conv;
14963 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14964 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14965 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14966 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);
14967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14969 long ret_ref = (long)ret_var.inner;
14970 if (ret_var.is_owned) {
14976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14977 LDKChannelAnnouncement orig_conv;
14978 orig_conv.inner = (void*)(orig & (~1));
14979 orig_conv.is_owned = false;
14980 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14983 long ret_ref = (long)ret_var.inner;
14984 if (ret_var.is_owned) {
14990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14991 LDKUnsignedChannelUpdate this_ptr_conv;
14992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14994 UnsignedChannelUpdate_free(this_ptr_conv);
14997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14998 LDKUnsignedChannelUpdate this_ptr_conv;
14999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15000 this_ptr_conv.is_owned = false;
15001 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
15006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15007 LDKUnsignedChannelUpdate this_ptr_conv;
15008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15009 this_ptr_conv.is_owned = false;
15010 LDKThirtyTwoBytes val_ref;
15011 CHECK((*env)->GetArrayLength(env, val) == 32);
15012 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15013 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
15016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15017 LDKUnsignedChannelUpdate this_ptr_conv;
15018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15019 this_ptr_conv.is_owned = false;
15020 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
15024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15025 LDKUnsignedChannelUpdate this_ptr_conv;
15026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15027 this_ptr_conv.is_owned = false;
15028 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
15031 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15032 LDKUnsignedChannelUpdate this_ptr_conv;
15033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15034 this_ptr_conv.is_owned = false;
15035 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
15039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15040 LDKUnsignedChannelUpdate this_ptr_conv;
15041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15042 this_ptr_conv.is_owned = false;
15043 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
15046 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
15047 LDKUnsignedChannelUpdate this_ptr_conv;
15048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15049 this_ptr_conv.is_owned = false;
15050 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
15054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
15055 LDKUnsignedChannelUpdate this_ptr_conv;
15056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15057 this_ptr_conv.is_owned = false;
15058 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
15061 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15062 LDKUnsignedChannelUpdate this_ptr_conv;
15063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15064 this_ptr_conv.is_owned = false;
15065 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
15069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15070 LDKUnsignedChannelUpdate this_ptr_conv;
15071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15072 this_ptr_conv.is_owned = false;
15073 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
15076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15077 LDKUnsignedChannelUpdate this_ptr_conv;
15078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15079 this_ptr_conv.is_owned = false;
15080 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
15084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15085 LDKUnsignedChannelUpdate this_ptr_conv;
15086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15087 this_ptr_conv.is_owned = false;
15088 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
15091 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15092 LDKUnsignedChannelUpdate this_ptr_conv;
15093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15094 this_ptr_conv.is_owned = false;
15095 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
15099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15100 LDKUnsignedChannelUpdate this_ptr_conv;
15101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15102 this_ptr_conv.is_owned = false;
15103 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
15106 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15107 LDKUnsignedChannelUpdate this_ptr_conv;
15108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15109 this_ptr_conv.is_owned = false;
15110 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
15114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15115 LDKUnsignedChannelUpdate this_ptr_conv;
15116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15117 this_ptr_conv.is_owned = false;
15118 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
15121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15122 LDKUnsignedChannelUpdate orig_conv;
15123 orig_conv.inner = (void*)(orig & (~1));
15124 orig_conv.is_owned = false;
15125 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
15126 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15127 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15128 long ret_ref = (long)ret_var.inner;
15129 if (ret_var.is_owned) {
15135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15136 LDKChannelUpdate this_ptr_conv;
15137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15139 ChannelUpdate_free(this_ptr_conv);
15142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15143 LDKChannelUpdate this_ptr_conv;
15144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15145 this_ptr_conv.is_owned = false;
15146 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15147 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
15151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15152 LDKChannelUpdate this_ptr_conv;
15153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15154 this_ptr_conv.is_owned = false;
15155 LDKSignature val_ref;
15156 CHECK((*env)->GetArrayLength(env, val) == 64);
15157 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15158 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15162 LDKChannelUpdate this_ptr_conv;
15163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15164 this_ptr_conv.is_owned = false;
15165 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
15166 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15167 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15168 long ret_ref = (long)ret_var.inner;
15169 if (ret_var.is_owned) {
15175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15176 LDKChannelUpdate this_ptr_conv;
15177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15178 this_ptr_conv.is_owned = false;
15179 LDKUnsignedChannelUpdate val_conv;
15180 val_conv.inner = (void*)(val & (~1));
15181 val_conv.is_owned = (val & 1) || (val == 0);
15182 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15183 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
15187 LDKSignature signature_arg_ref;
15188 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
15189 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
15190 LDKUnsignedChannelUpdate contents_arg_conv;
15191 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15192 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15193 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15194 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15195 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15196 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15197 long ret_ref = (long)ret_var.inner;
15198 if (ret_var.is_owned) {
15204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15205 LDKChannelUpdate orig_conv;
15206 orig_conv.inner = (void*)(orig & (~1));
15207 orig_conv.is_owned = false;
15208 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15209 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15210 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15211 long ret_ref = (long)ret_var.inner;
15212 if (ret_var.is_owned) {
15218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15219 LDKQueryChannelRange this_ptr_conv;
15220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15221 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15222 QueryChannelRange_free(this_ptr_conv);
15225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15226 LDKQueryChannelRange this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15230 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
15234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15235 LDKQueryChannelRange this_ptr_conv;
15236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15237 this_ptr_conv.is_owned = false;
15238 LDKThirtyTwoBytes val_ref;
15239 CHECK((*env)->GetArrayLength(env, val) == 32);
15240 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15241 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15244 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15245 LDKQueryChannelRange this_ptr_conv;
15246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15247 this_ptr_conv.is_owned = false;
15248 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15253 LDKQueryChannelRange this_ptr_conv;
15254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15255 this_ptr_conv.is_owned = false;
15256 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15259 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15260 LDKQueryChannelRange this_ptr_conv;
15261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15262 this_ptr_conv.is_owned = false;
15263 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15268 LDKQueryChannelRange this_ptr_conv;
15269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15270 this_ptr_conv.is_owned = false;
15271 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15274 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) {
15275 LDKThirtyTwoBytes chain_hash_arg_ref;
15276 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15277 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15278 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15281 long ret_ref = (long)ret_var.inner;
15282 if (ret_var.is_owned) {
15288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15289 LDKQueryChannelRange orig_conv;
15290 orig_conv.inner = (void*)(orig & (~1));
15291 orig_conv.is_owned = false;
15292 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15295 long ret_ref = (long)ret_var.inner;
15296 if (ret_var.is_owned) {
15302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15303 LDKReplyChannelRange this_ptr_conv;
15304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15306 ReplyChannelRange_free(this_ptr_conv);
15309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15310 LDKReplyChannelRange this_ptr_conv;
15311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15312 this_ptr_conv.is_owned = false;
15313 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
15318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15319 LDKReplyChannelRange this_ptr_conv;
15320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15321 this_ptr_conv.is_owned = false;
15322 LDKThirtyTwoBytes val_ref;
15323 CHECK((*env)->GetArrayLength(env, val) == 32);
15324 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15325 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15328 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15329 LDKReplyChannelRange this_ptr_conv;
15330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15331 this_ptr_conv.is_owned = false;
15332 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
15336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15337 LDKReplyChannelRange this_ptr_conv;
15338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15339 this_ptr_conv.is_owned = false;
15340 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
15343 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15344 LDKReplyChannelRange this_ptr_conv;
15345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15346 this_ptr_conv.is_owned = false;
15347 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
15351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15352 LDKReplyChannelRange this_ptr_conv;
15353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15354 this_ptr_conv.is_owned = false;
15355 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
15359 LDKReplyChannelRange this_ptr_conv;
15360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15361 this_ptr_conv.is_owned = false;
15362 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
15366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15367 LDKReplyChannelRange this_ptr_conv;
15368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15369 this_ptr_conv.is_owned = false;
15370 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
15373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15374 LDKReplyChannelRange this_ptr_conv;
15375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15376 this_ptr_conv.is_owned = false;
15377 LDKCVec_u64Z val_constr;
15378 val_constr.datalen = (*env)->GetArrayLength(env, val);
15379 if (val_constr.datalen > 0)
15380 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15382 val_constr.data = NULL;
15383 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15384 for (size_t g = 0; g < val_constr.datalen; g++) {
15385 int64_t val_conv_6 = val_vals[g];
15386 val_constr.data[g] = val_conv_6;
15388 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15389 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
15392 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) {
15393 LDKThirtyTwoBytes chain_hash_arg_ref;
15394 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15395 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15396 LDKCVec_u64Z short_channel_ids_arg_constr;
15397 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15398 if (short_channel_ids_arg_constr.datalen > 0)
15399 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15401 short_channel_ids_arg_constr.data = NULL;
15402 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15403 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15404 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15405 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15407 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15408 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
15409 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15410 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15411 long ret_ref = (long)ret_var.inner;
15412 if (ret_var.is_owned) {
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15419 LDKReplyChannelRange orig_conv;
15420 orig_conv.inner = (void*)(orig & (~1));
15421 orig_conv.is_owned = false;
15422 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
15423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15425 long ret_ref = (long)ret_var.inner;
15426 if (ret_var.is_owned) {
15432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15433 LDKQueryShortChannelIds this_ptr_conv;
15434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15436 QueryShortChannelIds_free(this_ptr_conv);
15439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15440 LDKQueryShortChannelIds this_ptr_conv;
15441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15442 this_ptr_conv.is_owned = false;
15443 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15444 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
15448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15449 LDKQueryShortChannelIds this_ptr_conv;
15450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15451 this_ptr_conv.is_owned = false;
15452 LDKThirtyTwoBytes val_ref;
15453 CHECK((*env)->GetArrayLength(env, val) == 32);
15454 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15455 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
15458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15459 LDKQueryShortChannelIds this_ptr_conv;
15460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15461 this_ptr_conv.is_owned = false;
15462 LDKCVec_u64Z val_constr;
15463 val_constr.datalen = (*env)->GetArrayLength(env, val);
15464 if (val_constr.datalen > 0)
15465 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15467 val_constr.data = NULL;
15468 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15469 for (size_t g = 0; g < val_constr.datalen; g++) {
15470 int64_t val_conv_6 = val_vals[g];
15471 val_constr.data[g] = val_conv_6;
15473 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15474 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
15477 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) {
15478 LDKThirtyTwoBytes chain_hash_arg_ref;
15479 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15480 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15481 LDKCVec_u64Z short_channel_ids_arg_constr;
15482 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15483 if (short_channel_ids_arg_constr.datalen > 0)
15484 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15486 short_channel_ids_arg_constr.data = NULL;
15487 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15488 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15489 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15490 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15492 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15493 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
15494 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15495 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15496 long ret_ref = (long)ret_var.inner;
15497 if (ret_var.is_owned) {
15503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15504 LDKQueryShortChannelIds orig_conv;
15505 orig_conv.inner = (void*)(orig & (~1));
15506 orig_conv.is_owned = false;
15507 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
15508 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15509 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15510 long ret_ref = (long)ret_var.inner;
15511 if (ret_var.is_owned) {
15517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15518 LDKReplyShortChannelIdsEnd this_ptr_conv;
15519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15521 ReplyShortChannelIdsEnd_free(this_ptr_conv);
15524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15525 LDKReplyShortChannelIdsEnd this_ptr_conv;
15526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15527 this_ptr_conv.is_owned = false;
15528 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
15533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15534 LDKReplyShortChannelIdsEnd this_ptr_conv;
15535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15536 this_ptr_conv.is_owned = false;
15537 LDKThirtyTwoBytes val_ref;
15538 CHECK((*env)->GetArrayLength(env, val) == 32);
15539 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15540 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
15543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
15544 LDKReplyShortChannelIdsEnd this_ptr_conv;
15545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15546 this_ptr_conv.is_owned = false;
15547 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
15551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15552 LDKReplyShortChannelIdsEnd this_ptr_conv;
15553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15554 this_ptr_conv.is_owned = false;
15555 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
15558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
15559 LDKThirtyTwoBytes chain_hash_arg_ref;
15560 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15561 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15562 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
15563 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15564 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15565 long ret_ref = (long)ret_var.inner;
15566 if (ret_var.is_owned) {
15572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15573 LDKReplyShortChannelIdsEnd orig_conv;
15574 orig_conv.inner = (void*)(orig & (~1));
15575 orig_conv.is_owned = false;
15576 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
15577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15579 long ret_ref = (long)ret_var.inner;
15580 if (ret_var.is_owned) {
15586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15587 LDKGossipTimestampFilter this_ptr_conv;
15588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15590 GossipTimestampFilter_free(this_ptr_conv);
15593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15594 LDKGossipTimestampFilter this_ptr_conv;
15595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15596 this_ptr_conv.is_owned = false;
15597 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
15602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15603 LDKGossipTimestampFilter this_ptr_conv;
15604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15605 this_ptr_conv.is_owned = false;
15606 LDKThirtyTwoBytes val_ref;
15607 CHECK((*env)->GetArrayLength(env, val) == 32);
15608 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15609 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15612 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15613 LDKGossipTimestampFilter this_ptr_conv;
15614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15615 this_ptr_conv.is_owned = false;
15616 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15621 LDKGossipTimestampFilter this_ptr_conv;
15622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15623 this_ptr_conv.is_owned = false;
15624 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15627 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
15628 LDKGossipTimestampFilter this_ptr_conv;
15629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15630 this_ptr_conv.is_owned = false;
15631 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15636 LDKGossipTimestampFilter this_ptr_conv;
15637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15638 this_ptr_conv.is_owned = false;
15639 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15642 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) {
15643 LDKThirtyTwoBytes chain_hash_arg_ref;
15644 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15645 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15646 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15647 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15648 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15649 long ret_ref = (long)ret_var.inner;
15650 if (ret_var.is_owned) {
15656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15657 LDKGossipTimestampFilter orig_conv;
15658 orig_conv.inner = (void*)(orig & (~1));
15659 orig_conv.is_owned = false;
15660 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
15661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15663 long ret_ref = (long)ret_var.inner;
15664 if (ret_var.is_owned) {
15670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15671 if ((this_ptr & 1) != 0) return;
15672 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
15673 FREE((void*)this_ptr);
15674 ErrorAction_free(this_ptr_conv);
15677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15678 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
15679 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15680 *ret_copy = ErrorAction_clone(orig_conv);
15681 long ret_ref = (long)ret_copy;
15685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15686 LDKLightningError this_ptr_conv;
15687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15689 LightningError_free(this_ptr_conv);
15692 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
15693 LDKLightningError this_ptr_conv;
15694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15695 this_ptr_conv.is_owned = false;
15696 LDKStr _str = LightningError_get_err(&this_ptr_conv);
15697 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
15701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15702 LDKLightningError this_ptr_conv;
15703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15704 this_ptr_conv.is_owned = false;
15705 LDKCVec_u8Z val_ref;
15706 val_ref.datalen = (*env)->GetArrayLength(env, val);
15707 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15708 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15709 LightningError_set_err(&this_ptr_conv, val_ref);
15712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
15713 LDKLightningError this_ptr_conv;
15714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15715 this_ptr_conv.is_owned = false;
15716 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15717 *ret_copy = LightningError_get_action(&this_ptr_conv);
15718 long ret_ref = (long)ret_copy;
15722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15723 LDKLightningError this_ptr_conv;
15724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15725 this_ptr_conv.is_owned = false;
15726 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
15728 LightningError_set_action(&this_ptr_conv, val_conv);
15731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
15732 LDKCVec_u8Z err_arg_ref;
15733 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
15734 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15735 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
15736 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
15737 FREE((void*)action_arg);
15738 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
15739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15741 long ret_ref = (long)ret_var.inner;
15742 if (ret_var.is_owned) {
15748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15749 LDKLightningError orig_conv;
15750 orig_conv.inner = (void*)(orig & (~1));
15751 orig_conv.is_owned = false;
15752 LDKLightningError ret_var = LightningError_clone(&orig_conv);
15753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15755 long ret_ref = (long)ret_var.inner;
15756 if (ret_var.is_owned) {
15762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15763 LDKCommitmentUpdate this_ptr_conv;
15764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15766 CommitmentUpdate_free(this_ptr_conv);
15769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15770 LDKCommitmentUpdate this_ptr_conv;
15771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15772 this_ptr_conv.is_owned = false;
15773 LDKCVec_UpdateAddHTLCZ val_constr;
15774 val_constr.datalen = (*env)->GetArrayLength(env, val);
15775 if (val_constr.datalen > 0)
15776 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15778 val_constr.data = NULL;
15779 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15780 for (size_t p = 0; p < val_constr.datalen; p++) {
15781 int64_t val_conv_15 = val_vals[p];
15782 LDKUpdateAddHTLC val_conv_15_conv;
15783 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
15784 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
15785 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
15786 val_constr.data[p] = val_conv_15_conv;
15788 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15789 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
15792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15793 LDKCommitmentUpdate this_ptr_conv;
15794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15795 this_ptr_conv.is_owned = false;
15796 LDKCVec_UpdateFulfillHTLCZ val_constr;
15797 val_constr.datalen = (*env)->GetArrayLength(env, val);
15798 if (val_constr.datalen > 0)
15799 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15801 val_constr.data = NULL;
15802 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15803 for (size_t t = 0; t < val_constr.datalen; t++) {
15804 int64_t val_conv_19 = val_vals[t];
15805 LDKUpdateFulfillHTLC val_conv_19_conv;
15806 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
15807 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
15808 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
15809 val_constr.data[t] = val_conv_19_conv;
15811 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15812 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
15815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15816 LDKCommitmentUpdate this_ptr_conv;
15817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15818 this_ptr_conv.is_owned = false;
15819 LDKCVec_UpdateFailHTLCZ val_constr;
15820 val_constr.datalen = (*env)->GetArrayLength(env, val);
15821 if (val_constr.datalen > 0)
15822 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15824 val_constr.data = NULL;
15825 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15826 for (size_t q = 0; q < val_constr.datalen; q++) {
15827 int64_t val_conv_16 = val_vals[q];
15828 LDKUpdateFailHTLC val_conv_16_conv;
15829 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
15830 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
15831 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
15832 val_constr.data[q] = val_conv_16_conv;
15834 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15835 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
15838 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) {
15839 LDKCommitmentUpdate this_ptr_conv;
15840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15841 this_ptr_conv.is_owned = false;
15842 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
15843 val_constr.datalen = (*env)->GetArrayLength(env, val);
15844 if (val_constr.datalen > 0)
15845 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15847 val_constr.data = NULL;
15848 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15849 for (size_t z = 0; z < val_constr.datalen; z++) {
15850 int64_t val_conv_25 = val_vals[z];
15851 LDKUpdateFailMalformedHTLC val_conv_25_conv;
15852 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
15853 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
15854 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
15855 val_constr.data[z] = val_conv_25_conv;
15857 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15858 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
15861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
15862 LDKCommitmentUpdate this_ptr_conv;
15863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15864 this_ptr_conv.is_owned = false;
15865 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
15866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15868 long ret_ref = (long)ret_var.inner;
15869 if (ret_var.is_owned) {
15875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15876 LDKCommitmentUpdate this_ptr_conv;
15877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15878 this_ptr_conv.is_owned = false;
15879 LDKUpdateFee val_conv;
15880 val_conv.inner = (void*)(val & (~1));
15881 val_conv.is_owned = (val & 1) || (val == 0);
15882 val_conv = UpdateFee_clone(&val_conv);
15883 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
15886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
15887 LDKCommitmentUpdate this_ptr_conv;
15888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15889 this_ptr_conv.is_owned = false;
15890 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15893 long ret_ref = (long)ret_var.inner;
15894 if (ret_var.is_owned) {
15900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15901 LDKCommitmentUpdate this_ptr_conv;
15902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15903 this_ptr_conv.is_owned = false;
15904 LDKCommitmentSigned val_conv;
15905 val_conv.inner = (void*)(val & (~1));
15906 val_conv.is_owned = (val & 1) || (val == 0);
15907 val_conv = CommitmentSigned_clone(&val_conv);
15908 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15911 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) {
15912 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15913 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
15914 if (update_add_htlcs_arg_constr.datalen > 0)
15915 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15917 update_add_htlcs_arg_constr.data = NULL;
15918 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
15919 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15920 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
15921 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
15922 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
15923 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
15924 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
15925 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
15927 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
15928 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15929 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
15930 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15931 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15933 update_fulfill_htlcs_arg_constr.data = NULL;
15934 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
15935 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15936 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
15937 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
15938 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
15939 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
15940 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
15941 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
15943 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
15944 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15945 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
15946 if (update_fail_htlcs_arg_constr.datalen > 0)
15947 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15949 update_fail_htlcs_arg_constr.data = NULL;
15950 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
15951 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15952 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
15953 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
15954 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
15955 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
15956 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
15957 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
15959 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
15960 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15961 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
15962 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15963 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15965 update_fail_malformed_htlcs_arg_constr.data = NULL;
15966 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
15967 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15968 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15969 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
15970 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
15971 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
15972 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
15973 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
15975 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
15976 LDKUpdateFee update_fee_arg_conv;
15977 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15978 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15979 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15980 LDKCommitmentSigned commitment_signed_arg_conv;
15981 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15982 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15983 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15984 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);
15985 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15986 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15987 long ret_ref = (long)ret_var.inner;
15988 if (ret_var.is_owned) {
15994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15995 LDKCommitmentUpdate orig_conv;
15996 orig_conv.inner = (void*)(orig & (~1));
15997 orig_conv.is_owned = false;
15998 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15999 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16000 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16001 long ret_ref = (long)ret_var.inner;
16002 if (ret_var.is_owned) {
16008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16009 if ((this_ptr & 1) != 0) return;
16010 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
16011 FREE((void*)this_ptr);
16012 HTLCFailChannelUpdate_free(this_ptr_conv);
16015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16016 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
16017 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
16018 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
16019 long ret_ref = (long)ret_copy;
16023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16024 if ((this_ptr & 1) != 0) return;
16025 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
16026 FREE((void*)this_ptr);
16027 ChannelMessageHandler_free(this_ptr_conv);
16030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16031 if ((this_ptr & 1) != 0) return;
16032 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
16033 FREE((void*)this_ptr);
16034 RoutingMessageHandler_free(this_ptr_conv);
16037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16038 LDKAcceptChannel obj_conv;
16039 obj_conv.inner = (void*)(obj & (~1));
16040 obj_conv.is_owned = false;
16041 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
16042 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16043 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16044 CVec_u8Z_free(ret_var);
16048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16049 LDKu8slice ser_ref;
16050 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16051 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16052 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
16053 *ret_conv = AcceptChannel_read(ser_ref);
16054 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16055 return (long)ret_conv;
16058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
16059 LDKAnnouncementSignatures obj_conv;
16060 obj_conv.inner = (void*)(obj & (~1));
16061 obj_conv.is_owned = false;
16062 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
16063 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16064 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16065 CVec_u8Z_free(ret_var);
16069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16070 LDKu8slice ser_ref;
16071 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16072 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16073 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
16074 *ret_conv = AnnouncementSignatures_read(ser_ref);
16075 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16076 return (long)ret_conv;
16079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
16080 LDKChannelReestablish obj_conv;
16081 obj_conv.inner = (void*)(obj & (~1));
16082 obj_conv.is_owned = false;
16083 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
16084 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16085 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16086 CVec_u8Z_free(ret_var);
16090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16091 LDKu8slice ser_ref;
16092 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16093 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16094 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
16095 *ret_conv = ChannelReestablish_read(ser_ref);
16096 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16097 return (long)ret_conv;
16100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16101 LDKClosingSigned obj_conv;
16102 obj_conv.inner = (void*)(obj & (~1));
16103 obj_conv.is_owned = false;
16104 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
16105 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16106 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16107 CVec_u8Z_free(ret_var);
16111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16112 LDKu8slice ser_ref;
16113 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16114 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16115 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
16116 *ret_conv = ClosingSigned_read(ser_ref);
16117 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16118 return (long)ret_conv;
16121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16122 LDKCommitmentSigned obj_conv;
16123 obj_conv.inner = (void*)(obj & (~1));
16124 obj_conv.is_owned = false;
16125 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
16126 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16127 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16128 CVec_u8Z_free(ret_var);
16132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16133 LDKu8slice ser_ref;
16134 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16135 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16136 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
16137 *ret_conv = CommitmentSigned_read(ser_ref);
16138 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16139 return (long)ret_conv;
16142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
16143 LDKFundingCreated obj_conv;
16144 obj_conv.inner = (void*)(obj & (~1));
16145 obj_conv.is_owned = false;
16146 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16147 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16148 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16149 CVec_u8Z_free(ret_var);
16153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16154 LDKu8slice ser_ref;
16155 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16156 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16157 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16158 *ret_conv = FundingCreated_read(ser_ref);
16159 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16160 return (long)ret_conv;
16163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16164 LDKFundingSigned obj_conv;
16165 obj_conv.inner = (void*)(obj & (~1));
16166 obj_conv.is_owned = false;
16167 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16168 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16169 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16170 CVec_u8Z_free(ret_var);
16174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16175 LDKu8slice ser_ref;
16176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16178 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16179 *ret_conv = FundingSigned_read(ser_ref);
16180 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16181 return (long)ret_conv;
16184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
16185 LDKFundingLocked obj_conv;
16186 obj_conv.inner = (void*)(obj & (~1));
16187 obj_conv.is_owned = false;
16188 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16189 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16190 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16191 CVec_u8Z_free(ret_var);
16195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16196 LDKu8slice ser_ref;
16197 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16198 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16199 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16200 *ret_conv = FundingLocked_read(ser_ref);
16201 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16202 return (long)ret_conv;
16205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
16207 obj_conv.inner = (void*)(obj & (~1));
16208 obj_conv.is_owned = false;
16209 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16210 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16211 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16212 CVec_u8Z_free(ret_var);
16216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16217 LDKu8slice ser_ref;
16218 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16219 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16220 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16221 *ret_conv = Init_read(ser_ref);
16222 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16223 return (long)ret_conv;
16226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16227 LDKOpenChannel obj_conv;
16228 obj_conv.inner = (void*)(obj & (~1));
16229 obj_conv.is_owned = false;
16230 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16231 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16232 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16233 CVec_u8Z_free(ret_var);
16237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16238 LDKu8slice ser_ref;
16239 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16240 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16241 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16242 *ret_conv = OpenChannel_read(ser_ref);
16243 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16244 return (long)ret_conv;
16247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
16248 LDKRevokeAndACK obj_conv;
16249 obj_conv.inner = (void*)(obj & (~1));
16250 obj_conv.is_owned = false;
16251 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16252 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16253 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16254 CVec_u8Z_free(ret_var);
16258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16259 LDKu8slice ser_ref;
16260 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16261 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16262 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16263 *ret_conv = RevokeAndACK_read(ser_ref);
16264 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16265 return (long)ret_conv;
16268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
16269 LDKShutdown obj_conv;
16270 obj_conv.inner = (void*)(obj & (~1));
16271 obj_conv.is_owned = false;
16272 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16273 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16274 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16275 CVec_u8Z_free(ret_var);
16279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16280 LDKu8slice ser_ref;
16281 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16282 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16283 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16284 *ret_conv = Shutdown_read(ser_ref);
16285 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16286 return (long)ret_conv;
16289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16290 LDKUpdateFailHTLC obj_conv;
16291 obj_conv.inner = (void*)(obj & (~1));
16292 obj_conv.is_owned = false;
16293 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16294 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16295 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16296 CVec_u8Z_free(ret_var);
16300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16301 LDKu8slice ser_ref;
16302 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16303 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16304 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16305 *ret_conv = UpdateFailHTLC_read(ser_ref);
16306 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16307 return (long)ret_conv;
16310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16311 LDKUpdateFailMalformedHTLC obj_conv;
16312 obj_conv.inner = (void*)(obj & (~1));
16313 obj_conv.is_owned = false;
16314 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16315 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16316 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16317 CVec_u8Z_free(ret_var);
16321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16322 LDKu8slice ser_ref;
16323 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16324 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16325 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16326 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16327 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16328 return (long)ret_conv;
16331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
16332 LDKUpdateFee obj_conv;
16333 obj_conv.inner = (void*)(obj & (~1));
16334 obj_conv.is_owned = false;
16335 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
16336 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16337 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16338 CVec_u8Z_free(ret_var);
16342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16343 LDKu8slice ser_ref;
16344 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16345 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16346 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16347 *ret_conv = UpdateFee_read(ser_ref);
16348 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16349 return (long)ret_conv;
16352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16353 LDKUpdateFulfillHTLC obj_conv;
16354 obj_conv.inner = (void*)(obj & (~1));
16355 obj_conv.is_owned = false;
16356 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
16357 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16358 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16359 CVec_u8Z_free(ret_var);
16363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16364 LDKu8slice ser_ref;
16365 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16366 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16367 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16368 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
16369 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16370 return (long)ret_conv;
16373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16374 LDKUpdateAddHTLC obj_conv;
16375 obj_conv.inner = (void*)(obj & (~1));
16376 obj_conv.is_owned = false;
16377 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
16378 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16379 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16380 CVec_u8Z_free(ret_var);
16384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16385 LDKu8slice ser_ref;
16386 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16387 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16388 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16389 *ret_conv = UpdateAddHTLC_read(ser_ref);
16390 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16391 return (long)ret_conv;
16394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
16396 obj_conv.inner = (void*)(obj & (~1));
16397 obj_conv.is_owned = false;
16398 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
16399 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16400 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16401 CVec_u8Z_free(ret_var);
16405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16406 LDKu8slice ser_ref;
16407 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16408 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16409 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16410 *ret_conv = Ping_read(ser_ref);
16411 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16412 return (long)ret_conv;
16415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
16417 obj_conv.inner = (void*)(obj & (~1));
16418 obj_conv.is_owned = false;
16419 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
16420 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16421 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16422 CVec_u8Z_free(ret_var);
16426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16427 LDKu8slice ser_ref;
16428 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16429 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16430 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16431 *ret_conv = Pong_read(ser_ref);
16432 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16433 return (long)ret_conv;
16436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16437 LDKUnsignedChannelAnnouncement obj_conv;
16438 obj_conv.inner = (void*)(obj & (~1));
16439 obj_conv.is_owned = false;
16440 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
16441 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16442 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16443 CVec_u8Z_free(ret_var);
16447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16448 LDKu8slice ser_ref;
16449 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16450 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16451 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16452 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
16453 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16454 return (long)ret_conv;
16457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16458 LDKChannelAnnouncement obj_conv;
16459 obj_conv.inner = (void*)(obj & (~1));
16460 obj_conv.is_owned = false;
16461 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
16462 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16463 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16464 CVec_u8Z_free(ret_var);
16468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_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_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16473 *ret_conv = ChannelAnnouncement_read(ser_ref);
16474 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16475 return (long)ret_conv;
16478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16479 LDKUnsignedChannelUpdate obj_conv;
16480 obj_conv.inner = (void*)(obj & (~1));
16481 obj_conv.is_owned = false;
16482 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
16483 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16484 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16485 CVec_u8Z_free(ret_var);
16489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16490 LDKu8slice ser_ref;
16491 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16492 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16493 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16494 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
16495 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16496 return (long)ret_conv;
16499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16500 LDKChannelUpdate obj_conv;
16501 obj_conv.inner = (void*)(obj & (~1));
16502 obj_conv.is_owned = false;
16503 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
16504 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16505 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16506 CVec_u8Z_free(ret_var);
16510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16511 LDKu8slice ser_ref;
16512 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16513 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16514 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16515 *ret_conv = ChannelUpdate_read(ser_ref);
16516 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16517 return (long)ret_conv;
16520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
16521 LDKErrorMessage obj_conv;
16522 obj_conv.inner = (void*)(obj & (~1));
16523 obj_conv.is_owned = false;
16524 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
16525 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16526 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16527 CVec_u8Z_free(ret_var);
16531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16532 LDKu8slice ser_ref;
16533 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16534 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16535 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16536 *ret_conv = ErrorMessage_read(ser_ref);
16537 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16538 return (long)ret_conv;
16541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16542 LDKUnsignedNodeAnnouncement obj_conv;
16543 obj_conv.inner = (void*)(obj & (~1));
16544 obj_conv.is_owned = false;
16545 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
16546 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16547 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16548 CVec_u8Z_free(ret_var);
16552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16553 LDKu8slice ser_ref;
16554 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16555 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16556 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16557 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
16558 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16559 return (long)ret_conv;
16562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16563 LDKNodeAnnouncement obj_conv;
16564 obj_conv.inner = (void*)(obj & (~1));
16565 obj_conv.is_owned = false;
16566 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
16567 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16568 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16569 CVec_u8Z_free(ret_var);
16573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16574 LDKu8slice ser_ref;
16575 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16576 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16577 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16578 *ret_conv = NodeAnnouncement_read(ser_ref);
16579 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16580 return (long)ret_conv;
16583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16584 LDKu8slice ser_ref;
16585 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16586 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16587 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16588 *ret_conv = QueryShortChannelIds_read(ser_ref);
16589 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16590 return (long)ret_conv;
16593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
16594 LDKQueryShortChannelIds obj_conv;
16595 obj_conv.inner = (void*)(obj & (~1));
16596 obj_conv.is_owned = false;
16597 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
16598 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16599 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16600 CVec_u8Z_free(ret_var);
16604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16605 LDKu8slice ser_ref;
16606 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16607 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16608 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16609 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
16610 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16611 return (long)ret_conv;
16614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
16615 LDKReplyShortChannelIdsEnd obj_conv;
16616 obj_conv.inner = (void*)(obj & (~1));
16617 obj_conv.is_owned = false;
16618 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
16619 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16620 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16621 CVec_u8Z_free(ret_var);
16625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16626 LDKu8slice ser_ref;
16627 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16628 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16629 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16630 *ret_conv = QueryChannelRange_read(ser_ref);
16631 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16632 return (long)ret_conv;
16635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
16636 LDKQueryChannelRange obj_conv;
16637 obj_conv.inner = (void*)(obj & (~1));
16638 obj_conv.is_owned = false;
16639 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16640 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16641 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16642 CVec_u8Z_free(ret_var);
16646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16647 LDKu8slice ser_ref;
16648 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16649 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16650 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16651 *ret_conv = ReplyChannelRange_read(ser_ref);
16652 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16653 return (long)ret_conv;
16656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
16657 LDKReplyChannelRange obj_conv;
16658 obj_conv.inner = (void*)(obj & (~1));
16659 obj_conv.is_owned = false;
16660 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
16661 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16662 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16663 CVec_u8Z_free(ret_var);
16667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16668 LDKu8slice ser_ref;
16669 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16670 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16671 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16672 *ret_conv = GossipTimestampFilter_read(ser_ref);
16673 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16674 return (long)ret_conv;
16677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
16678 LDKGossipTimestampFilter obj_conv;
16679 obj_conv.inner = (void*)(obj & (~1));
16680 obj_conv.is_owned = false;
16681 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
16682 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16683 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16684 CVec_u8Z_free(ret_var);
16688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16689 LDKIgnoringMessageHandler this_ptr_conv;
16690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16692 IgnoringMessageHandler_free(this_ptr_conv);
16695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
16696 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
16697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16699 long ret_ref = (long)ret_var.inner;
16700 if (ret_var.is_owned) {
16706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16707 LDKIgnoringMessageHandler this_arg_conv;
16708 this_arg_conv.inner = (void*)(this_arg & (~1));
16709 this_arg_conv.is_owned = false;
16710 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16711 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16716 LDKIgnoringMessageHandler this_arg_conv;
16717 this_arg_conv.inner = (void*)(this_arg & (~1));
16718 this_arg_conv.is_owned = false;
16719 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16720 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
16724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16725 LDKErroringMessageHandler this_ptr_conv;
16726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16728 ErroringMessageHandler_free(this_ptr_conv);
16731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
16732 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
16733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16735 long ret_ref = (long)ret_var.inner;
16736 if (ret_var.is_owned) {
16742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16743 LDKErroringMessageHandler this_arg_conv;
16744 this_arg_conv.inner = (void*)(this_arg & (~1));
16745 this_arg_conv.is_owned = false;
16746 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16747 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16752 LDKErroringMessageHandler this_arg_conv;
16753 this_arg_conv.inner = (void*)(this_arg & (~1));
16754 this_arg_conv.is_owned = false;
16755 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16756 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
16760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16761 LDKMessageHandler this_ptr_conv;
16762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16764 MessageHandler_free(this_ptr_conv);
16767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
16768 LDKMessageHandler this_ptr_conv;
16769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16770 this_ptr_conv.is_owned = false;
16771 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
16775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16776 LDKMessageHandler this_ptr_conv;
16777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16778 this_ptr_conv.is_owned = false;
16779 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
16780 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
16781 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16782 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
16784 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
16787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
16788 LDKMessageHandler this_ptr_conv;
16789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16790 this_ptr_conv.is_owned = false;
16791 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
16795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16796 LDKMessageHandler this_ptr_conv;
16797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16798 this_ptr_conv.is_owned = false;
16799 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
16800 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
16801 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16802 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
16804 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
16807 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) {
16808 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
16809 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
16810 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16811 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
16813 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
16814 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
16815 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16816 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
16818 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
16819 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16820 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16821 long ret_ref = (long)ret_var.inner;
16822 if (ret_var.is_owned) {
16828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16829 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
16830 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16831 *ret = SocketDescriptor_clone(orig_conv);
16835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16836 if ((this_ptr & 1) != 0) return;
16837 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
16838 FREE((void*)this_ptr);
16839 SocketDescriptor_free(this_ptr_conv);
16842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16843 LDKPeerHandleError this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16846 PeerHandleError_free(this_ptr_conv);
16849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
16850 LDKPeerHandleError this_ptr_conv;
16851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16852 this_ptr_conv.is_owned = false;
16853 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
16857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16858 LDKPeerHandleError this_ptr_conv;
16859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16860 this_ptr_conv.is_owned = false;
16861 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
16864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
16865 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
16866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16868 long ret_ref = (long)ret_var.inner;
16869 if (ret_var.is_owned) {
16875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16876 LDKPeerHandleError orig_conv;
16877 orig_conv.inner = (void*)(orig & (~1));
16878 orig_conv.is_owned = false;
16879 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
16880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16882 long ret_ref = (long)ret_var.inner;
16883 if (ret_var.is_owned) {
16889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16890 LDKPeerManager this_ptr_conv;
16891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16893 PeerManager_free(this_ptr_conv);
16896 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) {
16897 LDKMessageHandler message_handler_conv;
16898 message_handler_conv.inner = (void*)(message_handler & (~1));
16899 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
16900 // Warning: we need a move here but no clone is available for LDKMessageHandler
16901 LDKSecretKey our_node_secret_ref;
16902 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
16903 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
16904 unsigned char ephemeral_random_data_arr[32];
16905 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
16906 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
16907 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
16908 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16909 if (logger_conv.free == LDKLogger_JCalls_free) {
16910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16911 LDKLogger_JCalls_clone(logger_conv.this_arg);
16913 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
16914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16916 long ret_ref = (long)ret_var.inner;
16917 if (ret_var.is_owned) {
16923 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
16924 LDKPeerManager this_arg_conv;
16925 this_arg_conv.inner = (void*)(this_arg & (~1));
16926 this_arg_conv.is_owned = false;
16927 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
16928 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16930 for (size_t i = 0; i < ret_var.datalen; i++) {
16931 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
16932 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
16933 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16935 FREE(ret_var.data);
16939 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) {
16940 LDKPeerManager this_arg_conv;
16941 this_arg_conv.inner = (void*)(this_arg & (~1));
16942 this_arg_conv.is_owned = false;
16943 LDKPublicKey their_node_id_ref;
16944 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16945 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16946 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16947 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
16948 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16949 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
16951 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16952 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16953 return (long)ret_conv;
16956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
16957 LDKPeerManager this_arg_conv;
16958 this_arg_conv.inner = (void*)(this_arg & (~1));
16959 this_arg_conv.is_owned = false;
16960 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16961 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
16962 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16963 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
16965 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16966 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16967 return (long)ret_conv;
16970 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) {
16971 LDKPeerManager this_arg_conv;
16972 this_arg_conv.inner = (void*)(this_arg & (~1));
16973 this_arg_conv.is_owned = false;
16974 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
16975 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16976 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16977 return (long)ret_conv;
16980 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) {
16981 LDKPeerManager this_arg_conv;
16982 this_arg_conv.inner = (void*)(this_arg & (~1));
16983 this_arg_conv.is_owned = false;
16984 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
16985 LDKu8slice data_ref;
16986 data_ref.datalen = (*env)->GetArrayLength(env, data);
16987 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
16988 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16989 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16990 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
16991 return (long)ret_conv;
16994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16995 LDKPeerManager this_arg_conv;
16996 this_arg_conv.inner = (void*)(this_arg & (~1));
16997 this_arg_conv.is_owned = false;
16998 PeerManager_process_events(&this_arg_conv);
17001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17002 LDKPeerManager this_arg_conv;
17003 this_arg_conv.inner = (void*)(this_arg & (~1));
17004 this_arg_conv.is_owned = false;
17005 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
17006 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
17009 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) {
17010 LDKPeerManager this_arg_conv;
17011 this_arg_conv.inner = (void*)(this_arg & (~1));
17012 this_arg_conv.is_owned = false;
17013 LDKPublicKey node_id_ref;
17014 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17015 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17016 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
17019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
17020 LDKPeerManager this_arg_conv;
17021 this_arg_conv.inner = (void*)(this_arg & (~1));
17022 this_arg_conv.is_owned = false;
17023 PeerManager_timer_tick_occured(&this_arg_conv);
17026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
17027 unsigned char commitment_seed_arr[32];
17028 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17029 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
17030 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
17031 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
17036 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) {
17037 LDKPublicKey per_commitment_point_ref;
17038 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17039 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17040 unsigned char base_secret_arr[32];
17041 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
17042 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
17043 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
17044 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17045 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
17046 return (long)ret_conv;
17049 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) {
17050 LDKPublicKey per_commitment_point_ref;
17051 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17052 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17053 LDKPublicKey base_point_ref;
17054 CHECK((*env)->GetArrayLength(env, base_point) == 33);
17055 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
17056 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17057 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
17058 return (long)ret_conv;
17061 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) {
17062 unsigned char per_commitment_secret_arr[32];
17063 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
17064 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
17065 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
17066 unsigned char countersignatory_revocation_base_secret_arr[32];
17067 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
17068 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
17069 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
17070 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17071 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
17072 return (long)ret_conv;
17075 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) {
17076 LDKPublicKey per_commitment_point_ref;
17077 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17078 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17079 LDKPublicKey countersignatory_revocation_base_point_ref;
17080 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
17081 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
17082 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17083 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
17084 return (long)ret_conv;
17087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17088 LDKTxCreationKeys this_ptr_conv;
17089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17091 TxCreationKeys_free(this_ptr_conv);
17094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17095 LDKTxCreationKeys this_ptr_conv;
17096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17097 this_ptr_conv.is_owned = false;
17098 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17099 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
17103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17104 LDKTxCreationKeys this_ptr_conv;
17105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17106 this_ptr_conv.is_owned = false;
17107 LDKPublicKey val_ref;
17108 CHECK((*env)->GetArrayLength(env, val) == 33);
17109 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17110 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
17113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17114 LDKTxCreationKeys this_ptr_conv;
17115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17116 this_ptr_conv.is_owned = false;
17117 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17118 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
17122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17123 LDKTxCreationKeys this_ptr_conv;
17124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17125 this_ptr_conv.is_owned = false;
17126 LDKPublicKey val_ref;
17127 CHECK((*env)->GetArrayLength(env, val) == 33);
17128 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17129 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
17132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17133 LDKTxCreationKeys this_ptr_conv;
17134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17135 this_ptr_conv.is_owned = false;
17136 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17137 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
17141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17142 LDKTxCreationKeys this_ptr_conv;
17143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17144 this_ptr_conv.is_owned = false;
17145 LDKPublicKey val_ref;
17146 CHECK((*env)->GetArrayLength(env, val) == 33);
17147 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17148 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
17151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17152 LDKTxCreationKeys this_ptr_conv;
17153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17154 this_ptr_conv.is_owned = false;
17155 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
17160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17161 LDKTxCreationKeys this_ptr_conv;
17162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17163 this_ptr_conv.is_owned = false;
17164 LDKPublicKey val_ref;
17165 CHECK((*env)->GetArrayLength(env, val) == 33);
17166 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17167 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
17170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17171 LDKTxCreationKeys this_ptr_conv;
17172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17173 this_ptr_conv.is_owned = false;
17174 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
17179 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) {
17180 LDKTxCreationKeys this_ptr_conv;
17181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17182 this_ptr_conv.is_owned = false;
17183 LDKPublicKey val_ref;
17184 CHECK((*env)->GetArrayLength(env, val) == 33);
17185 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17186 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
17189 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) {
17190 LDKPublicKey per_commitment_point_arg_ref;
17191 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17192 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17193 LDKPublicKey revocation_key_arg_ref;
17194 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
17195 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
17196 LDKPublicKey broadcaster_htlc_key_arg_ref;
17197 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
17198 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
17199 LDKPublicKey countersignatory_htlc_key_arg_ref;
17200 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
17201 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
17202 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17203 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
17204 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
17205 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);
17206 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17207 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17208 long ret_ref = (long)ret_var.inner;
17209 if (ret_var.is_owned) {
17215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17216 LDKTxCreationKeys orig_conv;
17217 orig_conv.inner = (void*)(orig & (~1));
17218 orig_conv.is_owned = false;
17219 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17220 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17221 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17222 long ret_ref = (long)ret_var.inner;
17223 if (ret_var.is_owned) {
17229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17230 LDKTxCreationKeys obj_conv;
17231 obj_conv.inner = (void*)(obj & (~1));
17232 obj_conv.is_owned = false;
17233 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17236 CVec_u8Z_free(ret_var);
17240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17241 LDKu8slice ser_ref;
17242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17244 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17245 *ret_conv = TxCreationKeys_read(ser_ref);
17246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17247 return (long)ret_conv;
17250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17251 LDKChannelPublicKeys this_ptr_conv;
17252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17254 ChannelPublicKeys_free(this_ptr_conv);
17257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17258 LDKChannelPublicKeys this_ptr_conv;
17259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17260 this_ptr_conv.is_owned = false;
17261 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
17266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17267 LDKChannelPublicKeys this_ptr_conv;
17268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17269 this_ptr_conv.is_owned = false;
17270 LDKPublicKey val_ref;
17271 CHECK((*env)->GetArrayLength(env, val) == 33);
17272 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17273 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17277 LDKChannelPublicKeys this_ptr_conv;
17278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17279 this_ptr_conv.is_owned = false;
17280 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17281 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17286 LDKChannelPublicKeys this_ptr_conv;
17287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17288 this_ptr_conv.is_owned = false;
17289 LDKPublicKey val_ref;
17290 CHECK((*env)->GetArrayLength(env, val) == 33);
17291 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17292 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17296 LDKChannelPublicKeys this_ptr_conv;
17297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17298 this_ptr_conv.is_owned = false;
17299 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
17304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17305 LDKChannelPublicKeys this_ptr_conv;
17306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17307 this_ptr_conv.is_owned = false;
17308 LDKPublicKey val_ref;
17309 CHECK((*env)->GetArrayLength(env, val) == 33);
17310 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17311 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17315 LDKChannelPublicKeys this_ptr_conv;
17316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17317 this_ptr_conv.is_owned = false;
17318 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17319 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17324 LDKChannelPublicKeys this_ptr_conv;
17325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17326 this_ptr_conv.is_owned = false;
17327 LDKPublicKey val_ref;
17328 CHECK((*env)->GetArrayLength(env, val) == 33);
17329 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17330 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17334 LDKChannelPublicKeys this_ptr_conv;
17335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17336 this_ptr_conv.is_owned = false;
17337 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17338 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17343 LDKChannelPublicKeys this_ptr_conv;
17344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17345 this_ptr_conv.is_owned = false;
17346 LDKPublicKey val_ref;
17347 CHECK((*env)->GetArrayLength(env, val) == 33);
17348 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17349 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
17352 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) {
17353 LDKPublicKey funding_pubkey_arg_ref;
17354 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
17355 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
17356 LDKPublicKey revocation_basepoint_arg_ref;
17357 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
17358 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
17359 LDKPublicKey payment_point_arg_ref;
17360 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
17361 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
17362 LDKPublicKey delayed_payment_basepoint_arg_ref;
17363 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
17364 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
17365 LDKPublicKey htlc_basepoint_arg_ref;
17366 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
17367 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
17368 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);
17369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17371 long ret_ref = (long)ret_var.inner;
17372 if (ret_var.is_owned) {
17378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17379 LDKChannelPublicKeys orig_conv;
17380 orig_conv.inner = (void*)(orig & (~1));
17381 orig_conv.is_owned = false;
17382 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
17383 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17384 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17385 long ret_ref = (long)ret_var.inner;
17386 if (ret_var.is_owned) {
17392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17393 LDKChannelPublicKeys obj_conv;
17394 obj_conv.inner = (void*)(obj & (~1));
17395 obj_conv.is_owned = false;
17396 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
17397 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17398 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17399 CVec_u8Z_free(ret_var);
17403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17404 LDKu8slice ser_ref;
17405 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17406 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17407 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
17408 *ret_conv = ChannelPublicKeys_read(ser_ref);
17409 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17410 return (long)ret_conv;
17413 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) {
17414 LDKPublicKey per_commitment_point_ref;
17415 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17416 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17417 LDKPublicKey broadcaster_delayed_payment_base_ref;
17418 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
17419 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
17420 LDKPublicKey broadcaster_htlc_base_ref;
17421 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
17422 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
17423 LDKPublicKey countersignatory_revocation_base_ref;
17424 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
17425 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
17426 LDKPublicKey countersignatory_htlc_base_ref;
17427 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
17428 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
17429 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17430 *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);
17431 return (long)ret_conv;
17434 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) {
17435 LDKPublicKey per_commitment_point_ref;
17436 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17437 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17438 LDKChannelPublicKeys broadcaster_keys_conv;
17439 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17440 broadcaster_keys_conv.is_owned = false;
17441 LDKChannelPublicKeys countersignatory_keys_conv;
17442 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17443 countersignatory_keys_conv.is_owned = false;
17444 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17445 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
17446 return (long)ret_conv;
17449 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) {
17450 LDKPublicKey revocation_key_ref;
17451 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17452 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17453 LDKPublicKey broadcaster_delayed_payment_key_ref;
17454 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17455 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17456 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
17457 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17458 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17459 CVec_u8Z_free(ret_var);
17463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17464 LDKHTLCOutputInCommitment this_ptr_conv;
17465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17467 HTLCOutputInCommitment_free(this_ptr_conv);
17470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
17471 LDKHTLCOutputInCommitment this_ptr_conv;
17472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17473 this_ptr_conv.is_owned = false;
17474 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
17478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17479 LDKHTLCOutputInCommitment this_ptr_conv;
17480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17481 this_ptr_conv.is_owned = false;
17482 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
17485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17486 LDKHTLCOutputInCommitment this_ptr_conv;
17487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17488 this_ptr_conv.is_owned = false;
17489 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
17493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17494 LDKHTLCOutputInCommitment this_ptr_conv;
17495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17496 this_ptr_conv.is_owned = false;
17497 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
17500 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17501 LDKHTLCOutputInCommitment this_ptr_conv;
17502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17503 this_ptr_conv.is_owned = false;
17504 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
17508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17509 LDKHTLCOutputInCommitment this_ptr_conv;
17510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17511 this_ptr_conv.is_owned = false;
17512 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
17515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17516 LDKHTLCOutputInCommitment this_ptr_conv;
17517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17518 this_ptr_conv.is_owned = false;
17519 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
17524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17525 LDKHTLCOutputInCommitment this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = false;
17528 LDKThirtyTwoBytes val_ref;
17529 CHECK((*env)->GetArrayLength(env, val) == 32);
17530 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17531 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
17534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17535 LDKHTLCOutputInCommitment orig_conv;
17536 orig_conv.inner = (void*)(orig & (~1));
17537 orig_conv.is_owned = false;
17538 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
17539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17541 long ret_ref = (long)ret_var.inner;
17542 if (ret_var.is_owned) {
17548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
17549 LDKHTLCOutputInCommitment obj_conv;
17550 obj_conv.inner = (void*)(obj & (~1));
17551 obj_conv.is_owned = false;
17552 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
17553 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17554 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17555 CVec_u8Z_free(ret_var);
17559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17560 LDKu8slice ser_ref;
17561 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17562 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17563 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
17564 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
17565 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17566 return (long)ret_conv;
17569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
17570 LDKHTLCOutputInCommitment htlc_conv;
17571 htlc_conv.inner = (void*)(htlc & (~1));
17572 htlc_conv.is_owned = false;
17573 LDKTxCreationKeys keys_conv;
17574 keys_conv.inner = (void*)(keys & (~1));
17575 keys_conv.is_owned = false;
17576 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
17577 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17578 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17579 CVec_u8Z_free(ret_var);
17583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
17584 LDKPublicKey broadcaster_ref;
17585 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
17586 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
17587 LDKPublicKey countersignatory_ref;
17588 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
17589 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
17590 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
17591 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17592 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17593 CVec_u8Z_free(ret_var);
17597 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) {
17598 unsigned char prev_hash_arr[32];
17599 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
17600 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
17601 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
17602 LDKHTLCOutputInCommitment htlc_conv;
17603 htlc_conv.inner = (void*)(htlc & (~1));
17604 htlc_conv.is_owned = false;
17605 LDKPublicKey broadcaster_delayed_payment_key_ref;
17606 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17607 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17608 LDKPublicKey revocation_key_ref;
17609 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17610 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17611 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
17612 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17613 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17614 Transaction_free(ret_var);
17618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17619 LDKChannelTransactionParameters this_ptr_conv;
17620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17622 ChannelTransactionParameters_free(this_ptr_conv);
17625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
17626 LDKChannelTransactionParameters this_ptr_conv;
17627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17628 this_ptr_conv.is_owned = false;
17629 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
17630 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17631 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17632 long ret_ref = (long)ret_var.inner;
17633 if (ret_var.is_owned) {
17639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17640 LDKChannelTransactionParameters this_ptr_conv;
17641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17642 this_ptr_conv.is_owned = false;
17643 LDKChannelPublicKeys val_conv;
17644 val_conv.inner = (void*)(val & (~1));
17645 val_conv.is_owned = (val & 1) || (val == 0);
17646 val_conv = ChannelPublicKeys_clone(&val_conv);
17647 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
17650 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17651 LDKChannelTransactionParameters this_ptr_conv;
17652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17653 this_ptr_conv.is_owned = false;
17654 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
17658 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) {
17659 LDKChannelTransactionParameters this_ptr_conv;
17660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17661 this_ptr_conv.is_owned = false;
17662 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
17665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
17666 LDKChannelTransactionParameters this_ptr_conv;
17667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17668 this_ptr_conv.is_owned = false;
17669 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
17673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17674 LDKChannelTransactionParameters this_ptr_conv;
17675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17676 this_ptr_conv.is_owned = false;
17677 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
17680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
17681 LDKChannelTransactionParameters this_ptr_conv;
17682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17683 this_ptr_conv.is_owned = false;
17684 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
17685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17687 long ret_ref = (long)ret_var.inner;
17688 if (ret_var.is_owned) {
17694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17695 LDKChannelTransactionParameters this_ptr_conv;
17696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17697 this_ptr_conv.is_owned = false;
17698 LDKCounterpartyChannelTransactionParameters val_conv;
17699 val_conv.inner = (void*)(val & (~1));
17700 val_conv.is_owned = (val & 1) || (val == 0);
17701 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
17702 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
17705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17706 LDKChannelTransactionParameters this_ptr_conv;
17707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17708 this_ptr_conv.is_owned = false;
17709 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
17710 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17711 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17712 long ret_ref = (long)ret_var.inner;
17713 if (ret_var.is_owned) {
17719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17720 LDKChannelTransactionParameters this_ptr_conv;
17721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17722 this_ptr_conv.is_owned = false;
17723 LDKOutPoint val_conv;
17724 val_conv.inner = (void*)(val & (~1));
17725 val_conv.is_owned = (val & 1) || (val == 0);
17726 val_conv = OutPoint_clone(&val_conv);
17727 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
17730 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) {
17731 LDKChannelPublicKeys holder_pubkeys_arg_conv;
17732 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
17733 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
17734 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
17735 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
17736 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
17737 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
17738 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
17739 LDKOutPoint funding_outpoint_arg_conv;
17740 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
17741 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
17742 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
17743 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);
17744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17746 long ret_ref = (long)ret_var.inner;
17747 if (ret_var.is_owned) {
17753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17754 LDKChannelTransactionParameters orig_conv;
17755 orig_conv.inner = (void*)(orig & (~1));
17756 orig_conv.is_owned = false;
17757 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
17758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17760 long ret_ref = (long)ret_var.inner;
17761 if (ret_var.is_owned) {
17767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17768 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17771 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
17774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
17775 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17777 this_ptr_conv.is_owned = false;
17778 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
17779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17781 long ret_ref = (long)ret_var.inner;
17782 if (ret_var.is_owned) {
17788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17789 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17791 this_ptr_conv.is_owned = false;
17792 LDKChannelPublicKeys val_conv;
17793 val_conv.inner = (void*)(val & (~1));
17794 val_conv.is_owned = (val & 1) || (val == 0);
17795 val_conv = ChannelPublicKeys_clone(&val_conv);
17796 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
17799 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17800 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17802 this_ptr_conv.is_owned = false;
17803 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
17807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17808 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17810 this_ptr_conv.is_owned = false;
17811 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
17814 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) {
17815 LDKChannelPublicKeys pubkeys_arg_conv;
17816 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
17817 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
17818 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
17819 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
17820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17822 long ret_ref = (long)ret_var.inner;
17823 if (ret_var.is_owned) {
17829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17830 LDKCounterpartyChannelTransactionParameters orig_conv;
17831 orig_conv.inner = (void*)(orig & (~1));
17832 orig_conv.is_owned = false;
17833 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
17834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17836 long ret_ref = (long)ret_var.inner;
17837 if (ret_var.is_owned) {
17843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
17844 LDKChannelTransactionParameters this_arg_conv;
17845 this_arg_conv.inner = (void*)(this_arg & (~1));
17846 this_arg_conv.is_owned = false;
17847 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
17851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
17852 LDKChannelTransactionParameters this_arg_conv;
17853 this_arg_conv.inner = (void*)(this_arg & (~1));
17854 this_arg_conv.is_owned = false;
17855 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
17856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17858 long ret_ref = (long)ret_var.inner;
17859 if (ret_var.is_owned) {
17865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
17866 LDKChannelTransactionParameters this_arg_conv;
17867 this_arg_conv.inner = (void*)(this_arg & (~1));
17868 this_arg_conv.is_owned = false;
17869 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
17870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17872 long ret_ref = (long)ret_var.inner;
17873 if (ret_var.is_owned) {
17879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
17880 LDKCounterpartyChannelTransactionParameters obj_conv;
17881 obj_conv.inner = (void*)(obj & (~1));
17882 obj_conv.is_owned = false;
17883 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
17884 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17885 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17886 CVec_u8Z_free(ret_var);
17890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17891 LDKu8slice ser_ref;
17892 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17893 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17894 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
17895 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
17896 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17897 return (long)ret_conv;
17900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
17901 LDKChannelTransactionParameters obj_conv;
17902 obj_conv.inner = (void*)(obj & (~1));
17903 obj_conv.is_owned = false;
17904 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
17905 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17906 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17907 CVec_u8Z_free(ret_var);
17911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17912 LDKu8slice ser_ref;
17913 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17914 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17915 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
17916 *ret_conv = ChannelTransactionParameters_read(ser_ref);
17917 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17918 return (long)ret_conv;
17921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17922 LDKDirectedChannelTransactionParameters this_ptr_conv;
17923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17925 DirectedChannelTransactionParameters_free(this_ptr_conv);
17928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17929 LDKDirectedChannelTransactionParameters this_arg_conv;
17930 this_arg_conv.inner = (void*)(this_arg & (~1));
17931 this_arg_conv.is_owned = false;
17932 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
17933 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17934 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17935 long ret_ref = (long)ret_var.inner;
17936 if (ret_var.is_owned) {
17942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17943 LDKDirectedChannelTransactionParameters this_arg_conv;
17944 this_arg_conv.inner = (void*)(this_arg & (~1));
17945 this_arg_conv.is_owned = false;
17946 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
17947 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17948 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17949 long ret_ref = (long)ret_var.inner;
17950 if (ret_var.is_owned) {
17956 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17957 LDKDirectedChannelTransactionParameters this_arg_conv;
17958 this_arg_conv.inner = (void*)(this_arg & (~1));
17959 this_arg_conv.is_owned = false;
17960 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
17965 LDKDirectedChannelTransactionParameters this_arg_conv;
17966 this_arg_conv.inner = (void*)(this_arg & (~1));
17967 this_arg_conv.is_owned = false;
17968 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
17973 LDKDirectedChannelTransactionParameters this_arg_conv;
17974 this_arg_conv.inner = (void*)(this_arg & (~1));
17975 this_arg_conv.is_owned = false;
17976 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17977 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17978 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17979 long ret_ref = (long)ret_var.inner;
17980 if (ret_var.is_owned) {
17986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17987 LDKHolderCommitmentTransaction this_ptr_conv;
17988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17990 HolderCommitmentTransaction_free(this_ptr_conv);
17993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
17994 LDKHolderCommitmentTransaction this_ptr_conv;
17995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17996 this_ptr_conv.is_owned = false;
17997 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17998 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
18002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18003 LDKHolderCommitmentTransaction this_ptr_conv;
18004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18005 this_ptr_conv.is_owned = false;
18006 LDKSignature val_ref;
18007 CHECK((*env)->GetArrayLength(env, val) == 64);
18008 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18009 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
18012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18013 LDKHolderCommitmentTransaction this_ptr_conv;
18014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18015 this_ptr_conv.is_owned = false;
18016 LDKCVec_SignatureZ val_constr;
18017 val_constr.datalen = (*env)->GetArrayLength(env, val);
18018 if (val_constr.datalen > 0)
18019 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18021 val_constr.data = NULL;
18022 for (size_t i = 0; i < val_constr.datalen; i++) {
18023 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18024 LDKSignature val_conv_8_ref;
18025 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18026 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18027 val_constr.data[i] = val_conv_8_ref;
18029 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
18032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18033 LDKHolderCommitmentTransaction orig_conv;
18034 orig_conv.inner = (void*)(orig & (~1));
18035 orig_conv.is_owned = false;
18036 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
18037 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18038 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18039 long ret_ref = (long)ret_var.inner;
18040 if (ret_var.is_owned) {
18046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18047 LDKHolderCommitmentTransaction obj_conv;
18048 obj_conv.inner = (void*)(obj & (~1));
18049 obj_conv.is_owned = false;
18050 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
18051 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18052 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18053 CVec_u8Z_free(ret_var);
18057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18058 LDKu8slice ser_ref;
18059 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18060 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18061 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
18062 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
18063 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18064 return (long)ret_conv;
18067 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) {
18068 LDKCommitmentTransaction commitment_tx_conv;
18069 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
18070 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
18071 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
18072 LDKSignature counterparty_sig_ref;
18073 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
18074 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
18075 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
18076 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
18077 if (counterparty_htlc_sigs_constr.datalen > 0)
18078 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18080 counterparty_htlc_sigs_constr.data = NULL;
18081 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
18082 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
18083 LDKSignature counterparty_htlc_sigs_conv_8_ref;
18084 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
18085 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
18086 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
18088 LDKPublicKey holder_funding_key_ref;
18089 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
18090 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
18091 LDKPublicKey counterparty_funding_key_ref;
18092 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
18093 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
18094 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
18095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18097 long ret_ref = (long)ret_var.inner;
18098 if (ret_var.is_owned) {
18104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18105 LDKBuiltCommitmentTransaction this_ptr_conv;
18106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18108 BuiltCommitmentTransaction_free(this_ptr_conv);
18111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
18112 LDKBuiltCommitmentTransaction this_ptr_conv;
18113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18114 this_ptr_conv.is_owned = false;
18115 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
18116 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18117 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18118 Transaction_free(ret_var);
18122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18123 LDKBuiltCommitmentTransaction this_ptr_conv;
18124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18125 this_ptr_conv.is_owned = false;
18126 LDKTransaction val_ref;
18127 val_ref.datalen = (*env)->GetArrayLength(env, val);
18128 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
18129 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18130 val_ref.data_is_owned = true;
18131 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
18134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18135 LDKBuiltCommitmentTransaction this_ptr_conv;
18136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18137 this_ptr_conv.is_owned = false;
18138 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
18143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18144 LDKBuiltCommitmentTransaction this_ptr_conv;
18145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18146 this_ptr_conv.is_owned = false;
18147 LDKThirtyTwoBytes val_ref;
18148 CHECK((*env)->GetArrayLength(env, val) == 32);
18149 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18150 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
18153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
18154 LDKTransaction transaction_arg_ref;
18155 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
18156 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
18157 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
18158 transaction_arg_ref.data_is_owned = true;
18159 LDKThirtyTwoBytes txid_arg_ref;
18160 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
18161 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
18162 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18165 long ret_ref = (long)ret_var.inner;
18166 if (ret_var.is_owned) {
18172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18173 LDKBuiltCommitmentTransaction orig_conv;
18174 orig_conv.inner = (void*)(orig & (~1));
18175 orig_conv.is_owned = false;
18176 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18179 long ret_ref = (long)ret_var.inner;
18180 if (ret_var.is_owned) {
18186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18187 LDKBuiltCommitmentTransaction obj_conv;
18188 obj_conv.inner = (void*)(obj & (~1));
18189 obj_conv.is_owned = false;
18190 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18191 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18192 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18193 CVec_u8Z_free(ret_var);
18197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18198 LDKu8slice ser_ref;
18199 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18200 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18201 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18202 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18203 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18204 return (long)ret_conv;
18207 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) {
18208 LDKBuiltCommitmentTransaction this_arg_conv;
18209 this_arg_conv.inner = (void*)(this_arg & (~1));
18210 this_arg_conv.is_owned = false;
18211 LDKu8slice funding_redeemscript_ref;
18212 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18213 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18214 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18215 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
18216 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18220 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) {
18221 LDKBuiltCommitmentTransaction this_arg_conv;
18222 this_arg_conv.inner = (void*)(this_arg & (~1));
18223 this_arg_conv.is_owned = false;
18224 unsigned char funding_key_arr[32];
18225 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18226 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
18227 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18228 LDKu8slice funding_redeemscript_ref;
18229 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18230 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18231 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18232 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
18233 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18238 LDKCommitmentTransaction this_ptr_conv;
18239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18241 CommitmentTransaction_free(this_ptr_conv);
18244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18245 LDKCommitmentTransaction orig_conv;
18246 orig_conv.inner = (void*)(orig & (~1));
18247 orig_conv.is_owned = false;
18248 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
18249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18251 long ret_ref = (long)ret_var.inner;
18252 if (ret_var.is_owned) {
18258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18259 LDKCommitmentTransaction obj_conv;
18260 obj_conv.inner = (void*)(obj & (~1));
18261 obj_conv.is_owned = false;
18262 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
18263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18265 CVec_u8Z_free(ret_var);
18269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18270 LDKu8slice ser_ref;
18271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18273 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18274 *ret_conv = CommitmentTransaction_read(ser_ref);
18275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18276 return (long)ret_conv;
18279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
18280 LDKCommitmentTransaction this_arg_conv;
18281 this_arg_conv.inner = (void*)(this_arg & (~1));
18282 this_arg_conv.is_owned = false;
18283 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18288 LDKCommitmentTransaction this_arg_conv;
18289 this_arg_conv.inner = (void*)(this_arg & (~1));
18290 this_arg_conv.is_owned = false;
18291 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
18295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18296 LDKCommitmentTransaction this_arg_conv;
18297 this_arg_conv.inner = (void*)(this_arg & (~1));
18298 this_arg_conv.is_owned = false;
18299 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
18303 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
18304 LDKCommitmentTransaction this_arg_conv;
18305 this_arg_conv.inner = (void*)(this_arg & (~1));
18306 this_arg_conv.is_owned = false;
18307 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
18311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
18312 LDKCommitmentTransaction this_arg_conv;
18313 this_arg_conv.inner = (void*)(this_arg & (~1));
18314 this_arg_conv.is_owned = false;
18315 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
18316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18318 long ret_ref = (long)ret_var.inner;
18319 if (ret_var.is_owned) {
18325 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) {
18326 LDKCommitmentTransaction this_arg_conv;
18327 this_arg_conv.inner = (void*)(this_arg & (~1));
18328 this_arg_conv.is_owned = false;
18329 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18330 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18331 channel_parameters_conv.is_owned = false;
18332 LDKChannelPublicKeys broadcaster_keys_conv;
18333 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18334 broadcaster_keys_conv.is_owned = false;
18335 LDKChannelPublicKeys countersignatory_keys_conv;
18336 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18337 countersignatory_keys_conv.is_owned = false;
18338 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
18339 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
18340 return (long)ret_conv;
18343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18344 LDKTrustedCommitmentTransaction this_ptr_conv;
18345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18347 TrustedCommitmentTransaction_free(this_ptr_conv);
18350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
18351 LDKTrustedCommitmentTransaction this_arg_conv;
18352 this_arg_conv.inner = (void*)(this_arg & (~1));
18353 this_arg_conv.is_owned = false;
18354 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
18359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
18360 LDKTrustedCommitmentTransaction this_arg_conv;
18361 this_arg_conv.inner = (void*)(this_arg & (~1));
18362 this_arg_conv.is_owned = false;
18363 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
18364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18366 long ret_ref = (long)ret_var.inner;
18367 if (ret_var.is_owned) {
18373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
18374 LDKTrustedCommitmentTransaction this_arg_conv;
18375 this_arg_conv.inner = (void*)(this_arg & (~1));
18376 this_arg_conv.is_owned = false;
18377 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
18378 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18379 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18380 long ret_ref = (long)ret_var.inner;
18381 if (ret_var.is_owned) {
18387 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) {
18388 LDKTrustedCommitmentTransaction this_arg_conv;
18389 this_arg_conv.inner = (void*)(this_arg & (~1));
18390 this_arg_conv.is_owned = false;
18391 unsigned char htlc_base_key_arr[32];
18392 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
18393 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
18394 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
18395 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18396 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18397 channel_parameters_conv.is_owned = false;
18398 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
18399 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
18400 return (long)ret_conv;
18403 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) {
18404 LDKPublicKey broadcaster_payment_basepoint_ref;
18405 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
18406 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
18407 LDKPublicKey countersignatory_payment_basepoint_ref;
18408 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
18409 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
18410 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
18414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18415 LDKInitFeatures orig_conv;
18416 orig_conv.inner = (void*)(orig & (~1));
18417 orig_conv.is_owned = false;
18418 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
18419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18421 long ret_ref = (long)ret_var.inner;
18422 if (ret_var.is_owned) {
18428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18429 LDKNodeFeatures orig_conv;
18430 orig_conv.inner = (void*)(orig & (~1));
18431 orig_conv.is_owned = false;
18432 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
18433 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18434 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18435 long ret_ref = (long)ret_var.inner;
18436 if (ret_var.is_owned) {
18442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18443 LDKChannelFeatures orig_conv;
18444 orig_conv.inner = (void*)(orig & (~1));
18445 orig_conv.is_owned = false;
18446 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
18447 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18448 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18449 long ret_ref = (long)ret_var.inner;
18450 if (ret_var.is_owned) {
18456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18457 LDKInitFeatures this_ptr_conv;
18458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18460 InitFeatures_free(this_ptr_conv);
18463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18464 LDKNodeFeatures this_ptr_conv;
18465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18467 NodeFeatures_free(this_ptr_conv);
18470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18471 LDKChannelFeatures this_ptr_conv;
18472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18474 ChannelFeatures_free(this_ptr_conv);
18477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
18478 LDKInitFeatures ret_var = InitFeatures_empty();
18479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18481 long ret_ref = (long)ret_var.inner;
18482 if (ret_var.is_owned) {
18488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
18489 LDKInitFeatures ret_var = InitFeatures_known();
18490 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18491 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18492 long ret_ref = (long)ret_var.inner;
18493 if (ret_var.is_owned) {
18499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
18500 LDKNodeFeatures ret_var = NodeFeatures_empty();
18501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18503 long ret_ref = (long)ret_var.inner;
18504 if (ret_var.is_owned) {
18510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
18511 LDKNodeFeatures ret_var = NodeFeatures_known();
18512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18514 long ret_ref = (long)ret_var.inner;
18515 if (ret_var.is_owned) {
18521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
18522 LDKChannelFeatures ret_var = ChannelFeatures_empty();
18523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18525 long ret_ref = (long)ret_var.inner;
18526 if (ret_var.is_owned) {
18532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
18533 LDKChannelFeatures ret_var = ChannelFeatures_known();
18534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18536 long ret_ref = (long)ret_var.inner;
18537 if (ret_var.is_owned) {
18543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18544 LDKInitFeatures obj_conv;
18545 obj_conv.inner = (void*)(obj & (~1));
18546 obj_conv.is_owned = false;
18547 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
18548 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18549 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18550 CVec_u8Z_free(ret_var);
18554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18555 LDKNodeFeatures obj_conv;
18556 obj_conv.inner = (void*)(obj & (~1));
18557 obj_conv.is_owned = false;
18558 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
18559 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18560 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18561 CVec_u8Z_free(ret_var);
18565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18566 LDKChannelFeatures obj_conv;
18567 obj_conv.inner = (void*)(obj & (~1));
18568 obj_conv.is_owned = false;
18569 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
18570 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18571 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18572 CVec_u8Z_free(ret_var);
18576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18577 LDKu8slice ser_ref;
18578 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18579 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18580 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18581 *ret_conv = InitFeatures_read(ser_ref);
18582 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18583 return (long)ret_conv;
18586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18587 LDKu8slice ser_ref;
18588 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18589 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18590 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18591 *ret_conv = NodeFeatures_read(ser_ref);
18592 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18593 return (long)ret_conv;
18596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18597 LDKu8slice ser_ref;
18598 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18599 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18600 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18601 *ret_conv = ChannelFeatures_read(ser_ref);
18602 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18603 return (long)ret_conv;
18606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18607 LDKRouteHop this_ptr_conv;
18608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18610 RouteHop_free(this_ptr_conv);
18613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18614 LDKRouteHop this_ptr_conv;
18615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18616 this_ptr_conv.is_owned = false;
18617 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
18622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18623 LDKRouteHop this_ptr_conv;
18624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18625 this_ptr_conv.is_owned = false;
18626 LDKPublicKey val_ref;
18627 CHECK((*env)->GetArrayLength(env, val) == 33);
18628 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18629 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
18632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18633 LDKRouteHop this_ptr_conv;
18634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18635 this_ptr_conv.is_owned = false;
18636 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
18637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18639 long ret_ref = (long)ret_var.inner;
18640 if (ret_var.is_owned) {
18646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18647 LDKRouteHop this_ptr_conv;
18648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18649 this_ptr_conv.is_owned = false;
18650 LDKNodeFeatures val_conv;
18651 val_conv.inner = (void*)(val & (~1));
18652 val_conv.is_owned = (val & 1) || (val == 0);
18653 val_conv = NodeFeatures_clone(&val_conv);
18654 RouteHop_set_node_features(&this_ptr_conv, val_conv);
18657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18658 LDKRouteHop this_ptr_conv;
18659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18660 this_ptr_conv.is_owned = false;
18661 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
18665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18666 LDKRouteHop this_ptr_conv;
18667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18668 this_ptr_conv.is_owned = false;
18669 RouteHop_set_short_channel_id(&this_ptr_conv, val);
18672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18673 LDKRouteHop this_ptr_conv;
18674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18675 this_ptr_conv.is_owned = false;
18676 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
18677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18679 long ret_ref = (long)ret_var.inner;
18680 if (ret_var.is_owned) {
18686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18687 LDKRouteHop this_ptr_conv;
18688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18689 this_ptr_conv.is_owned = false;
18690 LDKChannelFeatures val_conv;
18691 val_conv.inner = (void*)(val & (~1));
18692 val_conv.is_owned = (val & 1) || (val == 0);
18693 val_conv = ChannelFeatures_clone(&val_conv);
18694 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
18697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18698 LDKRouteHop this_ptr_conv;
18699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18700 this_ptr_conv.is_owned = false;
18701 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
18705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18706 LDKRouteHop this_ptr_conv;
18707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18708 this_ptr_conv.is_owned = false;
18709 RouteHop_set_fee_msat(&this_ptr_conv, val);
18712 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18713 LDKRouteHop this_ptr_conv;
18714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18715 this_ptr_conv.is_owned = false;
18716 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
18720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18721 LDKRouteHop this_ptr_conv;
18722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18723 this_ptr_conv.is_owned = false;
18724 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
18727 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) {
18728 LDKPublicKey pubkey_arg_ref;
18729 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
18730 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
18731 LDKNodeFeatures node_features_arg_conv;
18732 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
18733 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
18734 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
18735 LDKChannelFeatures channel_features_arg_conv;
18736 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
18737 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
18738 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
18739 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);
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 int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18750 LDKRouteHop orig_conv;
18751 orig_conv.inner = (void*)(orig & (~1));
18752 orig_conv.is_owned = false;
18753 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
18754 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18755 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18756 long ret_ref = (long)ret_var.inner;
18757 if (ret_var.is_owned) {
18763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18764 LDKRoute this_ptr_conv;
18765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18767 Route_free(this_ptr_conv);
18770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18771 LDKRoute this_ptr_conv;
18772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18773 this_ptr_conv.is_owned = false;
18774 LDKCVec_CVec_RouteHopZZ val_constr;
18775 val_constr.datalen = (*env)->GetArrayLength(env, val);
18776 if (val_constr.datalen > 0)
18777 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18779 val_constr.data = NULL;
18780 for (size_t m = 0; m < val_constr.datalen; m++) {
18781 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
18782 LDKCVec_RouteHopZ val_conv_12_constr;
18783 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
18784 if (val_conv_12_constr.datalen > 0)
18785 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18787 val_conv_12_constr.data = NULL;
18788 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
18789 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
18790 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
18791 LDKRouteHop val_conv_12_conv_10_conv;
18792 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
18793 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
18794 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
18795 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
18797 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
18798 val_constr.data[m] = val_conv_12_constr;
18800 Route_set_paths(&this_ptr_conv, val_constr);
18803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
18804 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
18805 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
18806 if (paths_arg_constr.datalen > 0)
18807 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18809 paths_arg_constr.data = NULL;
18810 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
18811 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
18812 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
18813 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
18814 if (paths_arg_conv_12_constr.datalen > 0)
18815 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18817 paths_arg_conv_12_constr.data = NULL;
18818 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
18819 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
18820 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
18821 LDKRouteHop paths_arg_conv_12_conv_10_conv;
18822 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
18823 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
18824 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
18825 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
18827 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
18828 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
18830 LDKRoute ret_var = Route_new(paths_arg_constr);
18831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18833 long ret_ref = (long)ret_var.inner;
18834 if (ret_var.is_owned) {
18840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18841 LDKRoute orig_conv;
18842 orig_conv.inner = (void*)(orig & (~1));
18843 orig_conv.is_owned = false;
18844 LDKRoute ret_var = Route_clone(&orig_conv);
18845 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18846 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18847 long ret_ref = (long)ret_var.inner;
18848 if (ret_var.is_owned) {
18854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
18856 obj_conv.inner = (void*)(obj & (~1));
18857 obj_conv.is_owned = false;
18858 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
18859 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18860 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18861 CVec_u8Z_free(ret_var);
18865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18866 LDKu8slice ser_ref;
18867 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18868 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18869 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
18870 *ret_conv = Route_read(ser_ref);
18871 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18872 return (long)ret_conv;
18875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18876 LDKRouteHint this_ptr_conv;
18877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18879 RouteHint_free(this_ptr_conv);
18882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18883 LDKRouteHint this_ptr_conv;
18884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18885 this_ptr_conv.is_owned = false;
18886 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18887 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
18891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18892 LDKRouteHint this_ptr_conv;
18893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18894 this_ptr_conv.is_owned = false;
18895 LDKPublicKey val_ref;
18896 CHECK((*env)->GetArrayLength(env, val) == 33);
18897 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18898 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
18901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18902 LDKRouteHint this_ptr_conv;
18903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18904 this_ptr_conv.is_owned = false;
18905 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
18909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18910 LDKRouteHint this_ptr_conv;
18911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18912 this_ptr_conv.is_owned = false;
18913 RouteHint_set_short_channel_id(&this_ptr_conv, val);
18916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
18917 LDKRouteHint this_ptr_conv;
18918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18919 this_ptr_conv.is_owned = false;
18920 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
18921 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18922 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18923 long ret_ref = (long)ret_var.inner;
18924 if (ret_var.is_owned) {
18930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18931 LDKRouteHint this_ptr_conv;
18932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18933 this_ptr_conv.is_owned = false;
18934 LDKRoutingFees val_conv;
18935 val_conv.inner = (void*)(val & (~1));
18936 val_conv.is_owned = (val & 1) || (val == 0);
18937 val_conv = RoutingFees_clone(&val_conv);
18938 RouteHint_set_fees(&this_ptr_conv, val_conv);
18941 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18942 LDKRouteHint this_ptr_conv;
18943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18944 this_ptr_conv.is_owned = false;
18945 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18950 LDKRouteHint this_ptr_conv;
18951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18952 this_ptr_conv.is_owned = false;
18953 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18957 LDKRouteHint orig_conv;
18958 orig_conv.inner = (void*)(orig & (~1));
18959 orig_conv.is_owned = false;
18960 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18961 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18962 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18963 long ret_ref = (long)ret_var.inner;
18964 if (ret_var.is_owned) {
18970 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 payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
18971 LDKPublicKey our_node_id_ref;
18972 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
18973 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
18974 LDKNetworkGraph network_conv;
18975 network_conv.inner = (void*)(network & (~1));
18976 network_conv.is_owned = false;
18977 LDKPublicKey payee_ref;
18978 CHECK((*env)->GetArrayLength(env, payee) == 33);
18979 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
18980 LDKCVec_ChannelDetailsZ first_hops_constr;
18981 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
18982 if (first_hops_constr.datalen > 0)
18983 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18985 first_hops_constr.data = NULL;
18986 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
18987 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18988 int64_t first_hops_conv_16 = first_hops_vals[q];
18989 LDKChannelDetails first_hops_conv_16_conv;
18990 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
18991 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
18992 first_hops_constr.data[q] = first_hops_conv_16_conv;
18994 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
18995 LDKCVec_RouteHintZ last_hops_constr;
18996 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
18997 if (last_hops_constr.datalen > 0)
18998 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19000 last_hops_constr.data = NULL;
19001 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
19002 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
19003 int64_t last_hops_conv_11 = last_hops_vals[l];
19004 LDKRouteHint last_hops_conv_11_conv;
19005 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
19006 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
19007 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
19008 last_hops_constr.data[l] = last_hops_conv_11_conv;
19010 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
19011 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19012 if (logger_conv.free == LDKLogger_JCalls_free) {
19013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19014 LDKLogger_JCalls_clone(logger_conv.this_arg);
19016 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
19017 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
19018 FREE(first_hops_constr.data);
19019 return (long)ret_conv;
19022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19023 LDKNetworkGraph this_ptr_conv;
19024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19026 NetworkGraph_free(this_ptr_conv);
19029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19030 LDKNetworkGraph orig_conv;
19031 orig_conv.inner = (void*)(orig & (~1));
19032 orig_conv.is_owned = false;
19033 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
19034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19036 long ret_ref = (long)ret_var.inner;
19037 if (ret_var.is_owned) {
19043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19044 LDKLockedNetworkGraph this_ptr_conv;
19045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19047 LockedNetworkGraph_free(this_ptr_conv);
19050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19051 LDKNetGraphMsgHandler this_ptr_conv;
19052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19054 NetGraphMsgHandler_free(this_ptr_conv);
19057 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) {
19058 LDKThirtyTwoBytes genesis_hash_ref;
19059 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19060 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19061 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19062 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19063 if (logger_conv.free == LDKLogger_JCalls_free) {
19064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19065 LDKLogger_JCalls_clone(logger_conv.this_arg);
19067 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
19068 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19069 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19070 long ret_ref = (long)ret_var.inner;
19071 if (ret_var.is_owned) {
19077 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) {
19078 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19079 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19080 if (logger_conv.free == LDKLogger_JCalls_free) {
19081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19082 LDKLogger_JCalls_clone(logger_conv.this_arg);
19084 LDKNetworkGraph network_graph_conv;
19085 network_graph_conv.inner = (void*)(network_graph & (~1));
19086 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19087 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19088 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
19089 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19090 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19091 long ret_ref = (long)ret_var.inner;
19092 if (ret_var.is_owned) {
19098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
19099 LDKNetGraphMsgHandler this_arg_conv;
19100 this_arg_conv.inner = (void*)(this_arg & (~1));
19101 this_arg_conv.is_owned = false;
19102 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19103 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
19106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19107 LDKNetGraphMsgHandler this_arg_conv;
19108 this_arg_conv.inner = (void*)(this_arg & (~1));
19109 this_arg_conv.is_owned = false;
19110 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19113 long ret_ref = (long)ret_var.inner;
19114 if (ret_var.is_owned) {
19120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19121 LDKLockedNetworkGraph this_arg_conv;
19122 this_arg_conv.inner = (void*)(this_arg & (~1));
19123 this_arg_conv.is_owned = false;
19124 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19127 long ret_ref = (long)ret_var.inner;
19128 if (ret_var.is_owned) {
19134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
19135 LDKNetGraphMsgHandler this_arg_conv;
19136 this_arg_conv.inner = (void*)(this_arg & (~1));
19137 this_arg_conv.is_owned = false;
19138 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19139 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
19143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19144 LDKNetGraphMsgHandler this_arg_conv;
19145 this_arg_conv.inner = (void*)(this_arg & (~1));
19146 this_arg_conv.is_owned = false;
19147 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19148 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
19152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19153 LDKDirectionalChannelInfo this_ptr_conv;
19154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19156 DirectionalChannelInfo_free(this_ptr_conv);
19159 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
19160 LDKDirectionalChannelInfo this_ptr_conv;
19161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19162 this_ptr_conv.is_owned = false;
19163 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
19167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19168 LDKDirectionalChannelInfo this_ptr_conv;
19169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19170 this_ptr_conv.is_owned = false;
19171 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
19174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
19175 LDKDirectionalChannelInfo this_ptr_conv;
19176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19177 this_ptr_conv.is_owned = false;
19178 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
19182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19183 LDKDirectionalChannelInfo this_ptr_conv;
19184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19185 this_ptr_conv.is_owned = false;
19186 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
19189 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19190 LDKDirectionalChannelInfo this_ptr_conv;
19191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19192 this_ptr_conv.is_owned = false;
19193 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
19197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19198 LDKDirectionalChannelInfo this_ptr_conv;
19199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19200 this_ptr_conv.is_owned = false;
19201 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19205 LDKDirectionalChannelInfo this_ptr_conv;
19206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19207 this_ptr_conv.is_owned = false;
19208 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
19212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19213 LDKDirectionalChannelInfo this_ptr_conv;
19214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19215 this_ptr_conv.is_owned = false;
19216 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
19219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19220 LDKDirectionalChannelInfo this_ptr_conv;
19221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19222 this_ptr_conv.is_owned = false;
19223 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
19224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19226 long ret_ref = (long)ret_var.inner;
19227 if (ret_var.is_owned) {
19233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19234 LDKDirectionalChannelInfo this_ptr_conv;
19235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19236 this_ptr_conv.is_owned = false;
19237 LDKRoutingFees val_conv;
19238 val_conv.inner = (void*)(val & (~1));
19239 val_conv.is_owned = (val & 1) || (val == 0);
19240 val_conv = RoutingFees_clone(&val_conv);
19241 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
19244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19245 LDKDirectionalChannelInfo this_ptr_conv;
19246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19247 this_ptr_conv.is_owned = false;
19248 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
19249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19251 long ret_ref = (long)ret_var.inner;
19252 if (ret_var.is_owned) {
19258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19259 LDKDirectionalChannelInfo this_ptr_conv;
19260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19261 this_ptr_conv.is_owned = false;
19262 LDKChannelUpdate val_conv;
19263 val_conv.inner = (void*)(val & (~1));
19264 val_conv.is_owned = (val & 1) || (val == 0);
19265 val_conv = ChannelUpdate_clone(&val_conv);
19266 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
19269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19270 LDKDirectionalChannelInfo orig_conv;
19271 orig_conv.inner = (void*)(orig & (~1));
19272 orig_conv.is_owned = false;
19273 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
19274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19276 long ret_ref = (long)ret_var.inner;
19277 if (ret_var.is_owned) {
19283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19284 LDKDirectionalChannelInfo obj_conv;
19285 obj_conv.inner = (void*)(obj & (~1));
19286 obj_conv.is_owned = false;
19287 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
19288 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19289 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19290 CVec_u8Z_free(ret_var);
19294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19295 LDKu8slice ser_ref;
19296 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19297 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19298 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19299 *ret_conv = DirectionalChannelInfo_read(ser_ref);
19300 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19301 return (long)ret_conv;
19304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19305 LDKChannelInfo this_ptr_conv;
19306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19308 ChannelInfo_free(this_ptr_conv);
19311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19312 LDKChannelInfo this_ptr_conv;
19313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19314 this_ptr_conv.is_owned = false;
19315 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
19316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19318 long ret_ref = (long)ret_var.inner;
19319 if (ret_var.is_owned) {
19325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19326 LDKChannelInfo this_ptr_conv;
19327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19328 this_ptr_conv.is_owned = false;
19329 LDKChannelFeatures val_conv;
19330 val_conv.inner = (void*)(val & (~1));
19331 val_conv.is_owned = (val & 1) || (val == 0);
19332 val_conv = ChannelFeatures_clone(&val_conv);
19333 ChannelInfo_set_features(&this_ptr_conv, val_conv);
19336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19337 LDKChannelInfo this_ptr_conv;
19338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19339 this_ptr_conv.is_owned = false;
19340 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19341 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
19345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19346 LDKChannelInfo this_ptr_conv;
19347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19348 this_ptr_conv.is_owned = false;
19349 LDKPublicKey val_ref;
19350 CHECK((*env)->GetArrayLength(env, val) == 33);
19351 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19352 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
19355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19356 LDKChannelInfo this_ptr_conv;
19357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19358 this_ptr_conv.is_owned = false;
19359 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
19360 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19361 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19362 long ret_ref = (long)ret_var.inner;
19363 if (ret_var.is_owned) {
19369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19370 LDKChannelInfo this_ptr_conv;
19371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19372 this_ptr_conv.is_owned = false;
19373 LDKDirectionalChannelInfo val_conv;
19374 val_conv.inner = (void*)(val & (~1));
19375 val_conv.is_owned = (val & 1) || (val == 0);
19376 val_conv = DirectionalChannelInfo_clone(&val_conv);
19377 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
19380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19381 LDKChannelInfo this_ptr_conv;
19382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19383 this_ptr_conv.is_owned = false;
19384 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19385 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
19389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19390 LDKChannelInfo this_ptr_conv;
19391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19392 this_ptr_conv.is_owned = false;
19393 LDKPublicKey val_ref;
19394 CHECK((*env)->GetArrayLength(env, val) == 33);
19395 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19396 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
19399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19400 LDKChannelInfo this_ptr_conv;
19401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19402 this_ptr_conv.is_owned = false;
19403 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
19404 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19405 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19406 long ret_ref = (long)ret_var.inner;
19407 if (ret_var.is_owned) {
19413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19414 LDKChannelInfo this_ptr_conv;
19415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19416 this_ptr_conv.is_owned = false;
19417 LDKDirectionalChannelInfo val_conv;
19418 val_conv.inner = (void*)(val & (~1));
19419 val_conv.is_owned = (val & 1) || (val == 0);
19420 val_conv = DirectionalChannelInfo_clone(&val_conv);
19421 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
19424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19425 LDKChannelInfo this_ptr_conv;
19426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19427 this_ptr_conv.is_owned = false;
19428 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
19429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19431 long ret_ref = (long)ret_var.inner;
19432 if (ret_var.is_owned) {
19438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19439 LDKChannelInfo this_ptr_conv;
19440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19441 this_ptr_conv.is_owned = false;
19442 LDKChannelAnnouncement val_conv;
19443 val_conv.inner = (void*)(val & (~1));
19444 val_conv.is_owned = (val & 1) || (val == 0);
19445 val_conv = ChannelAnnouncement_clone(&val_conv);
19446 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
19449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19450 LDKChannelInfo orig_conv;
19451 orig_conv.inner = (void*)(orig & (~1));
19452 orig_conv.is_owned = false;
19453 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19456 long ret_ref = (long)ret_var.inner;
19457 if (ret_var.is_owned) {
19463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19464 LDKChannelInfo obj_conv;
19465 obj_conv.inner = (void*)(obj & (~1));
19466 obj_conv.is_owned = false;
19467 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19468 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19469 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19470 CVec_u8Z_free(ret_var);
19474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19475 LDKu8slice ser_ref;
19476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19478 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19479 *ret_conv = ChannelInfo_read(ser_ref);
19480 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19481 return (long)ret_conv;
19484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19485 LDKRoutingFees this_ptr_conv;
19486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19488 RoutingFees_free(this_ptr_conv);
19491 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19492 LDKRoutingFees this_ptr_conv;
19493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19494 this_ptr_conv.is_owned = false;
19495 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19500 LDKRoutingFees this_ptr_conv;
19501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19502 this_ptr_conv.is_owned = false;
19503 RoutingFees_set_base_msat(&this_ptr_conv, val);
19506 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19507 LDKRoutingFees this_ptr_conv;
19508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19509 this_ptr_conv.is_owned = false;
19510 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19515 LDKRoutingFees this_ptr_conv;
19516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19517 this_ptr_conv.is_owned = false;
19518 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19521 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) {
19522 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19525 long ret_ref = (long)ret_var.inner;
19526 if (ret_var.is_owned) {
19532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19533 LDKRoutingFees orig_conv;
19534 orig_conv.inner = (void*)(orig & (~1));
19535 orig_conv.is_owned = false;
19536 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19539 long ret_ref = (long)ret_var.inner;
19540 if (ret_var.is_owned) {
19546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19547 LDKu8slice ser_ref;
19548 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19549 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19550 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19551 *ret_conv = RoutingFees_read(ser_ref);
19552 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19553 return (long)ret_conv;
19556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
19557 LDKRoutingFees obj_conv;
19558 obj_conv.inner = (void*)(obj & (~1));
19559 obj_conv.is_owned = false;
19560 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
19561 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19562 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19563 CVec_u8Z_free(ret_var);
19567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19568 LDKNodeAnnouncementInfo this_ptr_conv;
19569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19571 NodeAnnouncementInfo_free(this_ptr_conv);
19574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19575 LDKNodeAnnouncementInfo this_ptr_conv;
19576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19577 this_ptr_conv.is_owned = false;
19578 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
19579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19581 long ret_ref = (long)ret_var.inner;
19582 if (ret_var.is_owned) {
19588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19589 LDKNodeAnnouncementInfo this_ptr_conv;
19590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19591 this_ptr_conv.is_owned = false;
19592 LDKNodeFeatures val_conv;
19593 val_conv.inner = (void*)(val & (~1));
19594 val_conv.is_owned = (val & 1) || (val == 0);
19595 val_conv = NodeFeatures_clone(&val_conv);
19596 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
19599 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
19600 LDKNodeAnnouncementInfo this_ptr_conv;
19601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19602 this_ptr_conv.is_owned = false;
19603 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
19607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19608 LDKNodeAnnouncementInfo this_ptr_conv;
19609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19610 this_ptr_conv.is_owned = false;
19611 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
19614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
19615 LDKNodeAnnouncementInfo this_ptr_conv;
19616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19617 this_ptr_conv.is_owned = false;
19618 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
19619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
19623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19624 LDKNodeAnnouncementInfo this_ptr_conv;
19625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19626 this_ptr_conv.is_owned = false;
19627 LDKThreeBytes val_ref;
19628 CHECK((*env)->GetArrayLength(env, val) == 3);
19629 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
19630 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
19633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
19634 LDKNodeAnnouncementInfo this_ptr_conv;
19635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19636 this_ptr_conv.is_owned = false;
19637 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
19642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19643 LDKNodeAnnouncementInfo this_ptr_conv;
19644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19645 this_ptr_conv.is_owned = false;
19646 LDKThirtyTwoBytes val_ref;
19647 CHECK((*env)->GetArrayLength(env, val) == 32);
19648 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19649 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
19652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19653 LDKNodeAnnouncementInfo this_ptr_conv;
19654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19655 this_ptr_conv.is_owned = false;
19656 LDKCVec_NetAddressZ val_constr;
19657 val_constr.datalen = (*env)->GetArrayLength(env, val);
19658 if (val_constr.datalen > 0)
19659 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19661 val_constr.data = NULL;
19662 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19663 for (size_t m = 0; m < val_constr.datalen; m++) {
19664 int64_t val_conv_12 = val_vals[m];
19665 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19666 FREE((void*)val_conv_12);
19667 val_constr.data[m] = val_conv_12_conv;
19669 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19670 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
19673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19674 LDKNodeAnnouncementInfo this_ptr_conv;
19675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19676 this_ptr_conv.is_owned = false;
19677 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
19678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19680 long ret_ref = (long)ret_var.inner;
19681 if (ret_var.is_owned) {
19687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19688 LDKNodeAnnouncementInfo this_ptr_conv;
19689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19690 this_ptr_conv.is_owned = false;
19691 LDKNodeAnnouncement val_conv;
19692 val_conv.inner = (void*)(val & (~1));
19693 val_conv.is_owned = (val & 1) || (val == 0);
19694 val_conv = NodeAnnouncement_clone(&val_conv);
19695 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
19698 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) {
19699 LDKNodeFeatures features_arg_conv;
19700 features_arg_conv.inner = (void*)(features_arg & (~1));
19701 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19702 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
19703 LDKThreeBytes rgb_arg_ref;
19704 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
19705 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
19706 LDKThirtyTwoBytes alias_arg_ref;
19707 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
19708 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
19709 LDKCVec_NetAddressZ addresses_arg_constr;
19710 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
19711 if (addresses_arg_constr.datalen > 0)
19712 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19714 addresses_arg_constr.data = NULL;
19715 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
19716 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
19717 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
19718 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
19719 FREE((void*)addresses_arg_conv_12);
19720 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
19722 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
19723 LDKNodeAnnouncement announcement_message_arg_conv;
19724 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19725 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19726 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
19727 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
19728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19730 long ret_ref = (long)ret_var.inner;
19731 if (ret_var.is_owned) {
19737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19738 LDKNodeAnnouncementInfo orig_conv;
19739 orig_conv.inner = (void*)(orig & (~1));
19740 orig_conv.is_owned = false;
19741 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
19742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19744 long ret_ref = (long)ret_var.inner;
19745 if (ret_var.is_owned) {
19751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19752 LDKNodeAnnouncementInfo obj_conv;
19753 obj_conv.inner = (void*)(obj & (~1));
19754 obj_conv.is_owned = false;
19755 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
19756 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19757 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19758 CVec_u8Z_free(ret_var);
19762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19763 LDKu8slice ser_ref;
19764 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19765 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19766 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19767 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
19768 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19769 return (long)ret_conv;
19772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19773 LDKNodeInfo this_ptr_conv;
19774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
19776 NodeInfo_free(this_ptr_conv);
19779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19780 LDKNodeInfo this_ptr_conv;
19781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19782 this_ptr_conv.is_owned = false;
19783 LDKCVec_u64Z val_constr;
19784 val_constr.datalen = (*env)->GetArrayLength(env, val);
19785 if (val_constr.datalen > 0)
19786 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19788 val_constr.data = NULL;
19789 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19790 for (size_t g = 0; g < val_constr.datalen; g++) {
19791 int64_t val_conv_6 = val_vals[g];
19792 val_constr.data[g] = val_conv_6;
19794 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19795 NodeInfo_set_channels(&this_ptr_conv, val_constr);
19798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19799 LDKNodeInfo this_ptr_conv;
19800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19801 this_ptr_conv.is_owned = false;
19802 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
19803 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19804 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19805 long ret_ref = (long)ret_var.inner;
19806 if (ret_var.is_owned) {
19812 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) {
19813 LDKNodeInfo this_ptr_conv;
19814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19815 this_ptr_conv.is_owned = false;
19816 LDKRoutingFees val_conv;
19817 val_conv.inner = (void*)(val & (~1));
19818 val_conv.is_owned = (val & 1) || (val == 0);
19819 val_conv = RoutingFees_clone(&val_conv);
19820 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
19823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
19824 LDKNodeInfo this_ptr_conv;
19825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19826 this_ptr_conv.is_owned = false;
19827 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
19828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19830 long ret_ref = (long)ret_var.inner;
19831 if (ret_var.is_owned) {
19837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19838 LDKNodeInfo this_ptr_conv;
19839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19840 this_ptr_conv.is_owned = false;
19841 LDKNodeAnnouncementInfo val_conv;
19842 val_conv.inner = (void*)(val & (~1));
19843 val_conv.is_owned = (val & 1) || (val == 0);
19844 val_conv = NodeAnnouncementInfo_clone(&val_conv);
19845 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
19848 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) {
19849 LDKCVec_u64Z channels_arg_constr;
19850 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
19851 if (channels_arg_constr.datalen > 0)
19852 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19854 channels_arg_constr.data = NULL;
19855 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
19856 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
19857 int64_t channels_arg_conv_6 = channels_arg_vals[g];
19858 channels_arg_constr.data[g] = channels_arg_conv_6;
19860 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
19861 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
19862 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
19863 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
19864 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
19865 LDKNodeAnnouncementInfo announcement_info_arg_conv;
19866 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
19867 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
19868 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
19869 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
19870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19872 long ret_ref = (long)ret_var.inner;
19873 if (ret_var.is_owned) {
19879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19880 LDKNodeInfo orig_conv;
19881 orig_conv.inner = (void*)(orig & (~1));
19882 orig_conv.is_owned = false;
19883 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
19884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19886 long ret_ref = (long)ret_var.inner;
19887 if (ret_var.is_owned) {
19893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19894 LDKNodeInfo obj_conv;
19895 obj_conv.inner = (void*)(obj & (~1));
19896 obj_conv.is_owned = false;
19897 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
19898 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19899 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19900 CVec_u8Z_free(ret_var);
19904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19905 LDKu8slice ser_ref;
19906 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19907 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19908 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19909 *ret_conv = NodeInfo_read(ser_ref);
19910 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19911 return (long)ret_conv;
19914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
19915 LDKNetworkGraph obj_conv;
19916 obj_conv.inner = (void*)(obj & (~1));
19917 obj_conv.is_owned = false;
19918 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
19919 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19920 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19921 CVec_u8Z_free(ret_var);
19925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19926 LDKu8slice ser_ref;
19927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19929 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19930 *ret_conv = NetworkGraph_read(ser_ref);
19931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19932 return (long)ret_conv;
19935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
19936 LDKThirtyTwoBytes genesis_hash_ref;
19937 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19938 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19939 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19940 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19941 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19942 long ret_ref = (long)ret_var.inner;
19943 if (ret_var.is_owned) {
19949 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) {
19950 LDKNetworkGraph this_arg_conv;
19951 this_arg_conv.inner = (void*)(this_arg & (~1));
19952 this_arg_conv.is_owned = false;
19953 LDKNodeAnnouncement msg_conv;
19954 msg_conv.inner = (void*)(msg & (~1));
19955 msg_conv.is_owned = false;
19956 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19957 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
19958 return (long)ret_conv;
19961 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) {
19962 LDKNetworkGraph this_arg_conv;
19963 this_arg_conv.inner = (void*)(this_arg & (~1));
19964 this_arg_conv.is_owned = false;
19965 LDKUnsignedNodeAnnouncement msg_conv;
19966 msg_conv.inner = (void*)(msg & (~1));
19967 msg_conv.is_owned = false;
19968 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19969 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
19970 return (long)ret_conv;
19973 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) {
19974 LDKNetworkGraph this_arg_conv;
19975 this_arg_conv.inner = (void*)(this_arg & (~1));
19976 this_arg_conv.is_owned = false;
19977 LDKChannelAnnouncement msg_conv;
19978 msg_conv.inner = (void*)(msg & (~1));
19979 msg_conv.is_owned = false;
19980 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19981 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19982 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
19983 return (long)ret_conv;
19986 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) {
19987 LDKNetworkGraph this_arg_conv;
19988 this_arg_conv.inner = (void*)(this_arg & (~1));
19989 this_arg_conv.is_owned = false;
19990 LDKUnsignedChannelAnnouncement msg_conv;
19991 msg_conv.inner = (void*)(msg & (~1));
19992 msg_conv.is_owned = false;
19993 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19994 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19995 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
19996 return (long)ret_conv;
19999 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) {
20000 LDKNetworkGraph this_arg_conv;
20001 this_arg_conv.inner = (void*)(this_arg & (~1));
20002 this_arg_conv.is_owned = false;
20003 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20007 LDKNetworkGraph this_arg_conv;
20008 this_arg_conv.inner = (void*)(this_arg & (~1));
20009 this_arg_conv.is_owned = false;
20010 LDKChannelUpdate msg_conv;
20011 msg_conv.inner = (void*)(msg & (~1));
20012 msg_conv.is_owned = false;
20013 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20014 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20015 return (long)ret_conv;
20018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20019 LDKNetworkGraph this_arg_conv;
20020 this_arg_conv.inner = (void*)(this_arg & (~1));
20021 this_arg_conv.is_owned = false;
20022 LDKUnsignedChannelUpdate msg_conv;
20023 msg_conv.inner = (void*)(msg & (~1));
20024 msg_conv.is_owned = false;
20025 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20026 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
20027 return (long)ret_conv;