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_B_clz = NULL;
116 static jclass arr_of_J_clz = NULL;
117 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
118 arr_of_B_clz = (*env)->FindClass(env, "[B");
119 CHECK(arr_of_B_clz != NULL);
120 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
121 arr_of_J_clz = (*env)->FindClass(env, "[J");
122 CHECK(arr_of_J_clz != NULL);
123 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_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 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
781 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
783 LDKMessageSendEvent_SendAcceptChannel_class =
784 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
785 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
786 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
787 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
788 LDKMessageSendEvent_SendOpenChannel_class =
789 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
790 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
791 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
792 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
793 LDKMessageSendEvent_SendFundingCreated_class =
794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
795 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
796 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
797 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
798 LDKMessageSendEvent_SendFundingSigned_class =
799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
800 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
801 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
802 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
803 LDKMessageSendEvent_SendFundingLocked_class =
804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
805 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
806 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
807 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
808 LDKMessageSendEvent_SendAnnouncementSignatures_class =
809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
810 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
811 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
812 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
813 LDKMessageSendEvent_UpdateHTLCs_class =
814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
815 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
816 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
817 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
818 LDKMessageSendEvent_SendRevokeAndACK_class =
819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
820 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
821 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
822 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
823 LDKMessageSendEvent_SendClosingSigned_class =
824 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
825 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
826 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
827 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
828 LDKMessageSendEvent_SendShutdown_class =
829 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
830 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
831 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
832 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
833 LDKMessageSendEvent_SendChannelReestablish_class =
834 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
835 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
836 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
837 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
838 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
840 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
841 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
842 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
843 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
845 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
846 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
847 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
848 LDKMessageSendEvent_BroadcastChannelUpdate_class =
849 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
850 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
851 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
852 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
853 LDKMessageSendEvent_HandleError_class =
854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
855 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
856 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
857 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
858 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
860 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
861 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
862 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
863 LDKMessageSendEvent_SendChannelRangeQuery_class =
864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
865 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
866 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
867 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
868 LDKMessageSendEvent_SendShortIdsQuery_class =
869 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
870 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
871 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
872 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
873 LDKMessageSendEvent_SendReplyChannelRange_class =
874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
875 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
876 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
877 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
879 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
880 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
882 case LDKMessageSendEvent_SendAcceptChannel: {
883 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
884 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
885 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
886 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
887 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
888 long msg_ref = (long)msg_var.inner & ~1;
889 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
891 case LDKMessageSendEvent_SendOpenChannel: {
892 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
893 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
894 LDKOpenChannel msg_var = obj->send_open_channel.msg;
895 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
896 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
897 long msg_ref = (long)msg_var.inner & ~1;
898 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
900 case LDKMessageSendEvent_SendFundingCreated: {
901 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
902 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
903 LDKFundingCreated msg_var = obj->send_funding_created.msg;
904 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
905 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
906 long msg_ref = (long)msg_var.inner & ~1;
907 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
909 case LDKMessageSendEvent_SendFundingSigned: {
910 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
911 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
912 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
913 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
914 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
915 long msg_ref = (long)msg_var.inner & ~1;
916 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
918 case LDKMessageSendEvent_SendFundingLocked: {
919 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
920 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
921 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
922 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
923 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
924 long msg_ref = (long)msg_var.inner & ~1;
925 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
927 case LDKMessageSendEvent_SendAnnouncementSignatures: {
928 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
929 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
930 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
931 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
932 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
933 long msg_ref = (long)msg_var.inner & ~1;
934 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
936 case LDKMessageSendEvent_UpdateHTLCs: {
937 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
938 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
939 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
940 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 long updates_ref = (long)updates_var.inner & ~1;
943 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
945 case LDKMessageSendEvent_SendRevokeAndACK: {
946 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
947 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
948 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
949 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 long msg_ref = (long)msg_var.inner & ~1;
952 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
954 case LDKMessageSendEvent_SendClosingSigned: {
955 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
956 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
957 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
958 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
959 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
960 long msg_ref = (long)msg_var.inner & ~1;
961 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
963 case LDKMessageSendEvent_SendShutdown: {
964 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
965 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
966 LDKShutdown msg_var = obj->send_shutdown.msg;
967 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
968 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
969 long msg_ref = (long)msg_var.inner & ~1;
970 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
972 case LDKMessageSendEvent_SendChannelReestablish: {
973 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
974 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
975 LDKChannelReestablish msg_var = obj->send_channel_reestablish.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 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
981 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
982 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
983 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
984 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
985 long msg_ref = (long)msg_var.inner & ~1;
986 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
987 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
988 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
989 long update_msg_ref = (long)update_msg_var.inner & ~1;
990 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
992 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
993 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.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_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
999 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1000 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1001 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1002 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1003 long msg_ref = (long)msg_var.inner & ~1;
1004 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1006 case LDKMessageSendEvent_HandleError: {
1007 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1008 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1009 long action_ref = ((long)&obj->handle_error.action) | 1;
1010 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1012 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1013 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1014 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1016 case LDKMessageSendEvent_SendChannelRangeQuery: {
1017 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1018 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1019 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1020 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 long msg_ref = (long)msg_var.inner & ~1;
1023 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1025 case LDKMessageSendEvent_SendShortIdsQuery: {
1026 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1027 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1028 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1029 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1030 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1031 long msg_ref = (long)msg_var.inner & ~1;
1032 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1034 case LDKMessageSendEvent_SendReplyChannelRange: {
1035 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1036 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1037 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1038 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1039 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1040 long msg_ref = (long)msg_var.inner & ~1;
1041 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1047 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1048 ret->datalen = (*env)->GetArrayLength(env, elems);
1049 if (ret->datalen == 0) {
1052 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1053 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1054 for (size_t i = 0; i < ret->datalen; i++) {
1055 int64_t arr_elem = java_elems[i];
1056 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1057 FREE((void*)arr_elem);
1058 ret->data[i] = arr_elem_conv;
1060 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1064 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1065 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1066 for (size_t i = 0; i < ret.datalen; i++) {
1067 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1072 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1075 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1076 CHECK(val->result_ok);
1077 return *val->contents.result;
1079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1080 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1081 CHECK(!val->result_ok);
1082 LDKLightningError err_var = (*val->contents.err);
1083 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1084 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1085 long err_ref = (long)err_var.inner & ~1;
1088 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) {
1089 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1090 LDKChannelAnnouncement a_conv;
1091 a_conv.inner = (void*)(a & (~1));
1092 a_conv.is_owned = (a & 1) || (a == 0);
1093 a_conv = ChannelAnnouncement_clone(&a_conv);
1095 LDKChannelUpdate b_conv;
1096 b_conv.inner = (void*)(b & (~1));
1097 b_conv.is_owned = (b & 1) || (b == 0);
1098 b_conv = ChannelUpdate_clone(&b_conv);
1100 LDKChannelUpdate c_conv;
1101 c_conv.inner = (void*)(c & (~1));
1102 c_conv.is_owned = (c & 1) || (c == 0);
1103 c_conv = ChannelUpdate_clone(&c_conv);
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1108 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1109 LDKChannelAnnouncement a_var = tuple->a;
1110 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 long a_ref = (long)a_var.inner & ~1;
1115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1116 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1117 LDKChannelUpdate b_var = tuple->b;
1118 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1119 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1120 long b_ref = (long)b_var.inner & ~1;
1123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
1124 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1125 LDKChannelUpdate c_var = tuple->c;
1126 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 long c_ref = (long)c_var.inner & ~1;
1131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1132 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1133 ret->datalen = (*env)->GetArrayLength(env, elems);
1134 if (ret->datalen == 0) {
1137 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1138 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1139 for (size_t i = 0; i < ret->datalen; i++) {
1140 int64_t arr_elem = java_elems[i];
1141 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1142 FREE((void*)arr_elem);
1143 ret->data[i] = arr_elem_conv;
1145 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1149 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
1150 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
1151 for (size_t i = 0; i < ret.datalen; i++) {
1152 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
1156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1157 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
1158 ret->datalen = (*env)->GetArrayLength(env, elems);
1159 if (ret->datalen == 0) {
1162 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
1163 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1164 for (size_t i = 0; i < ret->datalen; i++) {
1165 int64_t arr_elem = java_elems[i];
1166 LDKNodeAnnouncement arr_elem_conv;
1167 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1168 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1169 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
1170 ret->data[i] = arr_elem_conv;
1172 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1176 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
1177 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
1178 for (size_t i = 0; i < ret.datalen; i++) {
1179 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
1183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1184 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
1186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1187 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1188 CHECK(val->result_ok);
1189 return *val->contents.result;
1191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1192 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1193 CHECK(!val->result_ok);
1194 LDKLightningError err_var = (*val->contents.err);
1195 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1196 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1197 long err_ref = (long)err_var.inner & ~1;
1200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1201 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
1203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1204 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1205 CHECK(val->result_ok);
1206 LDKCVec_u8Z res_var = (*val->contents.result);
1207 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
1208 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
1211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1212 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1213 CHECK(!val->result_ok);
1214 LDKPeerHandleError err_var = (*val->contents.err);
1215 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1216 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 long err_ref = (long)err_var.inner & ~1;
1220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1221 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
1223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1224 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1225 CHECK(val->result_ok);
1226 return *val->contents.result;
1228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1229 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1230 CHECK(!val->result_ok);
1231 LDKPeerHandleError err_var = (*val->contents.err);
1232 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1233 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1234 long err_ref = (long)err_var.inner & ~1;
1237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1238 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
1240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1241 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1242 CHECK(val->result_ok);
1243 return *val->contents.result;
1245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1246 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1247 CHECK(!val->result_ok);
1248 LDKPeerHandleError err_var = (*val->contents.err);
1249 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1250 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1251 long err_ref = (long)err_var.inner & ~1;
1254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1255 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1258 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1259 CHECK(val->result_ok);
1260 LDKInitFeatures res_var = (*val->contents.result);
1261 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1262 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 long res_ref = (long)res_var.inner & ~1;
1266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1267 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1268 CHECK(!val->result_ok);
1269 LDKDecodeError err_var = (*val->contents.err);
1270 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1271 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1272 long err_ref = (long)err_var.inner & ~1;
1275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1276 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1279 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1280 CHECK(val->result_ok);
1281 LDKNodeFeatures res_var = (*val->contents.result);
1282 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 long res_ref = (long)res_var.inner & ~1;
1287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1288 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1289 CHECK(!val->result_ok);
1290 LDKDecodeError err_var = (*val->contents.err);
1291 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1292 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1293 long err_ref = (long)err_var.inner & ~1;
1296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1297 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1300 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1301 CHECK(val->result_ok);
1302 LDKChannelFeatures res_var = (*val->contents.result);
1303 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1304 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1305 long res_ref = (long)res_var.inner & ~1;
1308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1309 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1310 CHECK(!val->result_ok);
1311 LDKDecodeError err_var = (*val->contents.err);
1312 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1313 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1314 long err_ref = (long)err_var.inner & ~1;
1317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1318 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1321 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1322 CHECK(val->result_ok);
1323 LDKInvoiceFeatures res_var = (*val->contents.result);
1324 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1325 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1326 long res_ref = (long)res_var.inner & ~1;
1329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1330 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1331 CHECK(!val->result_ok);
1332 LDKDecodeError err_var = (*val->contents.err);
1333 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1334 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1335 long err_ref = (long)err_var.inner & ~1;
1338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1339 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
1341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1342 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1343 CHECK(val->result_ok);
1344 LDKChannelConfig res_var = (*val->contents.result);
1345 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1346 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1347 long res_ref = (long)res_var.inner & ~1;
1350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1351 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1352 CHECK(!val->result_ok);
1353 LDKDecodeError err_var = (*val->contents.err);
1354 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1355 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1356 long err_ref = (long)err_var.inner & ~1;
1359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1360 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1363 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1364 CHECK(val->result_ok);
1365 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1366 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1367 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1368 long res_ref = (long)res_var.inner & ~1;
1371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1372 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1373 CHECK(!val->result_ok);
1374 LDKDecodeError err_var = (*val->contents.err);
1375 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1376 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1377 long err_ref = (long)err_var.inner & ~1;
1380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1381 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1384 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1385 CHECK(val->result_ok);
1386 LDKChannelInfo res_var = (*val->contents.result);
1387 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1388 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1389 long res_ref = (long)res_var.inner & ~1;
1392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1393 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1394 CHECK(!val->result_ok);
1395 LDKDecodeError err_var = (*val->contents.err);
1396 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1397 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1398 long err_ref = (long)err_var.inner & ~1;
1401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1402 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1405 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1406 CHECK(val->result_ok);
1407 LDKRoutingFees res_var = (*val->contents.result);
1408 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1409 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1410 long res_ref = (long)res_var.inner & ~1;
1413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1414 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1415 CHECK(!val->result_ok);
1416 LDKDecodeError err_var = (*val->contents.err);
1417 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 long err_ref = (long)err_var.inner & ~1;
1422 static jclass LDKNetAddress_IPv4_class = NULL;
1423 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1424 static jclass LDKNetAddress_IPv6_class = NULL;
1425 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1426 static jclass LDKNetAddress_OnionV2_class = NULL;
1427 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1428 static jclass LDKNetAddress_OnionV3_class = NULL;
1429 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
1430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
1431 LDKNetAddress_IPv4_class =
1432 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
1433 CHECK(LDKNetAddress_IPv4_class != NULL);
1434 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
1435 CHECK(LDKNetAddress_IPv4_meth != NULL);
1436 LDKNetAddress_IPv6_class =
1437 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
1438 CHECK(LDKNetAddress_IPv6_class != NULL);
1439 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
1440 CHECK(LDKNetAddress_IPv6_meth != NULL);
1441 LDKNetAddress_OnionV2_class =
1442 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
1443 CHECK(LDKNetAddress_OnionV2_class != NULL);
1444 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
1445 CHECK(LDKNetAddress_OnionV2_meth != NULL);
1446 LDKNetAddress_OnionV3_class =
1447 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
1448 CHECK(LDKNetAddress_OnionV3_class != NULL);
1449 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
1450 CHECK(LDKNetAddress_OnionV3_meth != NULL);
1452 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1453 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1455 case LDKNetAddress_IPv4: {
1456 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
1457 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
1458 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
1460 case LDKNetAddress_IPv6: {
1461 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
1462 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
1463 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
1465 case LDKNetAddress_OnionV2: {
1466 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
1467 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
1468 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
1470 case LDKNetAddress_OnionV3: {
1471 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
1472 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
1473 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);
1478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1479 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1480 ret->datalen = (*env)->GetArrayLength(env, elems);
1481 if (ret->datalen == 0) {
1484 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1485 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1486 for (size_t i = 0; i < ret->datalen; i++) {
1487 int64_t arr_elem = java_elems[i];
1488 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1489 FREE((void*)arr_elem);
1490 ret->data[i] = arr_elem_conv;
1492 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1496 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1497 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1498 for (size_t i = 0; i < ret.datalen; i++) {
1499 ret.data[i] = NetAddress_clone(&orig->data[i]);
1503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1504 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1507 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1508 CHECK(val->result_ok);
1509 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1510 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1511 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1512 long res_ref = (long)res_var.inner & ~1;
1515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1516 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1517 CHECK(!val->result_ok);
1518 LDKDecodeError err_var = (*val->contents.err);
1519 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1520 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1521 long err_ref = (long)err_var.inner & ~1;
1524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1525 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1526 ret->datalen = (*env)->GetArrayLength(env, elems);
1527 if (ret->datalen == 0) {
1530 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1531 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1532 for (size_t i = 0; i < ret->datalen; i++) {
1533 ret->data[i] = java_elems[i];
1535 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1539 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1540 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1541 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1545 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1548 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1549 CHECK(val->result_ok);
1550 LDKNodeInfo res_var = (*val->contents.result);
1551 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1552 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1553 long res_ref = (long)res_var.inner & ~1;
1556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1557 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1558 CHECK(!val->result_ok);
1559 LDKDecodeError err_var = (*val->contents.err);
1560 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1561 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1562 long err_ref = (long)err_var.inner & ~1;
1565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1566 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1569 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1570 CHECK(val->result_ok);
1571 LDKNetworkGraph res_var = (*val->contents.result);
1572 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1573 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1574 long res_ref = (long)res_var.inner & ~1;
1577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1578 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1579 CHECK(!val->result_ok);
1580 LDKDecodeError err_var = (*val->contents.err);
1581 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1582 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1583 long err_ref = (long)err_var.inner & ~1;
1586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1587 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1589 LDKTransaction b_ref;
1590 b_ref.datalen = (*env)->GetArrayLength(env, b);
1591 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1592 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1593 b_ref.data_is_owned = false;
1597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1598 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1602 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1603 LDKTransaction b_var = tuple->b;
1604 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1605 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1609 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1610 ret->datalen = (*env)->GetArrayLength(env, elems);
1611 if (ret->datalen == 0) {
1614 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1615 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1616 for (size_t i = 0; i < ret->datalen; i++) {
1617 int64_t arr_elem = java_elems[i];
1618 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1619 FREE((void*)arr_elem);
1620 ret->data[i] = arr_elem_conv;
1622 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1627 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1630 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1631 CHECK(val->result_ok);
1632 return *val->contents.result;
1634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1635 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1636 CHECK(!val->result_ok);
1637 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1640 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1641 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1642 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1643 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1645 LDKMonitorEvent_HTLCEvent_class =
1646 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1647 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1648 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "()V");
1649 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1650 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1651 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1652 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1653 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "()V");
1654 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1656 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1657 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1659 case LDKMonitorEvent_HTLCEvent: {
1660 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth);
1662 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1663 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth);
1668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1669 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1670 ret->datalen = (*env)->GetArrayLength(env, elems);
1671 if (ret->datalen == 0) {
1674 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1675 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1676 for (size_t i = 0; i < ret->datalen; i++) {
1677 int64_t arr_elem = java_elems[i];
1678 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1679 FREE((void*)arr_elem);
1680 ret->data[i] = arr_elem_conv;
1682 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1686 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1687 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1688 for (size_t i = 0; i < ret.datalen; i++) {
1689 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1693 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1694 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1695 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1696 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1697 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1698 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1700 LDKSpendableOutputDescriptor_StaticOutput_class =
1701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1702 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1703 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1704 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1705 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1706 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1707 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1708 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "()V");
1709 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1710 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1712 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1713 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "()V");
1714 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1717 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1719 case LDKSpendableOutputDescriptor_StaticOutput: {
1720 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1721 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1722 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1723 long outpoint_ref = (long)outpoint_var.inner & ~1;
1724 long output_ref = ((long)&obj->static_output.output) | 1;
1725 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
1727 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1728 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth);
1730 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1731 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth);
1736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1737 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1738 ret->datalen = (*env)->GetArrayLength(env, elems);
1739 if (ret->datalen == 0) {
1742 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1743 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1744 for (size_t i = 0; i < ret->datalen; i++) {
1745 int64_t arr_elem = java_elems[i];
1746 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1747 FREE((void*)arr_elem);
1748 ret->data[i] = arr_elem_conv;
1750 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1754 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1755 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1756 for (size_t i = 0; i < ret.datalen; i++) {
1757 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1761 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1762 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1763 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1764 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1765 static jclass LDKEvent_PaymentReceived_class = NULL;
1766 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1767 static jclass LDKEvent_PaymentSent_class = NULL;
1768 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1769 static jclass LDKEvent_PaymentFailed_class = NULL;
1770 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1771 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1772 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1773 static jclass LDKEvent_SpendableOutputs_class = NULL;
1774 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1776 LDKEvent_FundingGenerationReady_class =
1777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1778 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1779 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1780 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1781 LDKEvent_FundingBroadcastSafe_class =
1782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1783 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1784 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1785 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1786 LDKEvent_PaymentReceived_class =
1787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1788 CHECK(LDKEvent_PaymentReceived_class != NULL);
1789 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1790 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1791 LDKEvent_PaymentSent_class =
1792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1793 CHECK(LDKEvent_PaymentSent_class != NULL);
1794 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1795 CHECK(LDKEvent_PaymentSent_meth != NULL);
1796 LDKEvent_PaymentFailed_class =
1797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1798 CHECK(LDKEvent_PaymentFailed_class != NULL);
1799 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1800 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1801 LDKEvent_PendingHTLCsForwardable_class =
1802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1803 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1804 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1805 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1806 LDKEvent_SpendableOutputs_class =
1807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1808 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1809 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1810 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1812 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1813 LDKEvent *obj = (LDKEvent*)ptr;
1815 case LDKEvent_FundingGenerationReady: {
1816 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1817 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1818 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1819 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1820 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1821 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);
1823 case LDKEvent_FundingBroadcastSafe: {
1824 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1825 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1826 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1827 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1828 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1830 case LDKEvent_PaymentReceived: {
1831 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1832 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1833 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1834 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1835 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1837 case LDKEvent_PaymentSent: {
1838 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1839 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1840 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1842 case LDKEvent_PaymentFailed: {
1843 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1844 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1845 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1847 case LDKEvent_PendingHTLCsForwardable: {
1848 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1850 case LDKEvent_SpendableOutputs: {
1851 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1852 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1853 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1854 for (size_t b = 0; b < outputs_var.datalen; b++) {
1855 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1856 outputs_arr_ptr[b] = outputs_conv_27_ref;
1858 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1859 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1865 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1866 ret->datalen = (*env)->GetArrayLength(env, elems);
1867 if (ret->datalen == 0) {
1870 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1871 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1872 for (size_t i = 0; i < ret->datalen; i++) {
1873 int64_t arr_elem = java_elems[i];
1874 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1875 FREE((void*)arr_elem);
1876 ret->data[i] = arr_elem_conv;
1878 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1882 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1883 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1884 for (size_t i = 0; i < ret.datalen; i++) {
1885 ret.data[i] = Event_clone(&orig->data[i]);
1889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1890 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1893 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1894 CHECK(val->result_ok);
1895 LDKOutPoint res_var = (*val->contents.result);
1896 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1897 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1898 long res_ref = (long)res_var.inner & ~1;
1901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1902 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1903 CHECK(!val->result_ok);
1904 LDKDecodeError err_var = (*val->contents.err);
1905 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1906 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1907 long err_ref = (long)err_var.inner & ~1;
1910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1911 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1914 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1915 CHECK(val->result_ok);
1916 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1917 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1918 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1919 long res_ref = (long)res_var.inner & ~1;
1922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1923 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1924 CHECK(!val->result_ok);
1925 LDKDecodeError err_var = (*val->contents.err);
1926 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 long err_ref = (long)err_var.inner & ~1;
1931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1932 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1935 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1936 CHECK(val->result_ok);
1937 LDKHTLCUpdate res_var = (*val->contents.result);
1938 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1939 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1940 long res_ref = (long)res_var.inner & ~1;
1943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1944 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1945 CHECK(!val->result_ok);
1946 LDKDecodeError err_var = (*val->contents.err);
1947 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1948 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1949 long err_ref = (long)err_var.inner & ~1;
1952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1953 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1956 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1957 CHECK(val->result_ok);
1958 return *val->contents.result;
1960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1961 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1962 CHECK(!val->result_ok);
1963 LDKMonitorUpdateError err_var = (*val->contents.err);
1964 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1965 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1966 long err_ref = (long)err_var.inner & ~1;
1969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1970 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1972 a_conv.inner = (void*)(a & (~1));
1973 a_conv.is_owned = (a & 1) || (a == 0);
1974 a_conv = OutPoint_clone(&a_conv);
1977 b_ref.datalen = (*env)->GetArrayLength(env, b);
1978 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1979 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1984 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1985 LDKOutPoint a_var = tuple->a;
1986 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1987 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1988 long a_ref = (long)a_var.inner & ~1;
1991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1992 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1993 LDKCVec_u8Z b_var = tuple->b;
1994 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1995 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
1999 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
2002 b_ref.datalen = (*env)->GetArrayLength(env, b);
2003 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
2004 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
2008 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2009 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
2012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2013 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
2014 LDKCVec_u8Z b_var = tuple->b;
2015 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
2016 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
2019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2020 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
2021 ret->datalen = (*env)->GetArrayLength(env, elems);
2022 if (ret->datalen == 0) {
2025 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
2026 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2027 for (size_t i = 0; i < ret->datalen; i++) {
2028 int64_t arr_elem = java_elems[i];
2029 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
2030 FREE((void*)arr_elem);
2031 ret->data[i] = arr_elem_conv;
2033 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2037 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
2038 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
2039 for (size_t i = 0; i < ret.datalen; i++) {
2040 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
2044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2045 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
2046 LDKThirtyTwoBytes a_ref;
2047 CHECK((*env)->GetArrayLength(env, a) == 32);
2048 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2050 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
2051 b_constr.datalen = (*env)->GetArrayLength(env, b);
2052 if (b_constr.datalen > 0)
2053 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
2055 b_constr.data = NULL;
2056 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2057 for (size_t b = 0; b < b_constr.datalen; b++) {
2058 int64_t b_conv_27 = b_vals[b];
2059 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
2060 FREE((void*)b_conv_27);
2061 b_constr.data[b] = b_conv_27_conv;
2063 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2068 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2069 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2070 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2073 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2074 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2075 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
2076 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2077 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2078 for (size_t b = 0; b < b_var.datalen; b++) {
2079 long b_conv_27_ref = (long)(&b_var.data[b]) | 1;
2080 b_arr_ptr[b] = b_conv_27_ref;
2082 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2086 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
2087 ret->datalen = (*env)->GetArrayLength(env, elems);
2088 if (ret->datalen == 0) {
2091 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
2092 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2093 for (size_t i = 0; i < ret->datalen; i++) {
2094 int64_t arr_elem = java_elems[i];
2095 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
2096 FREE((void*)arr_elem);
2097 ret->data[i] = arr_elem_conv;
2099 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
2104 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
2106 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
2111 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2112 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2116 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2117 long b_ref = ((long)&tuple->b) | 1;
2120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2121 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
2122 ret->datalen = (*env)->GetArrayLength(env, elems);
2123 if (ret->datalen == 0) {
2126 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
2127 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2128 for (size_t i = 0; i < ret->datalen; i++) {
2129 int64_t arr_elem = java_elems[i];
2130 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
2131 FREE((void*)arr_elem);
2132 ret->data[i] = arr_elem_conv;
2134 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2138 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
2139 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
2140 for (size_t i = 0; i < ret.datalen; i++) {
2141 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
2145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2146 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
2147 LDKThirtyTwoBytes a_ref;
2148 CHECK((*env)->GetArrayLength(env, a) == 32);
2149 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2151 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
2152 b_constr.datalen = (*env)->GetArrayLength(env, b);
2153 if (b_constr.datalen > 0)
2154 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
2156 b_constr.data = NULL;
2157 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2158 for (size_t a = 0; a < b_constr.datalen; a++) {
2159 int64_t b_conv_26 = b_vals[a];
2160 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
2161 FREE((void*)b_conv_26);
2162 b_constr.data[a] = b_conv_26_conv;
2164 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2169 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2170 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2171 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2174 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2175 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2176 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
2177 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2178 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2179 for (size_t a = 0; a < b_var.datalen; a++) {
2180 long b_conv_26_ref = (long)(&b_var.data[a]) | 1;
2181 b_arr_ptr[a] = b_conv_26_ref;
2183 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2187 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
2188 ret->datalen = (*env)->GetArrayLength(env, elems);
2189 if (ret->datalen == 0) {
2192 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
2193 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2194 for (size_t i = 0; i < ret->datalen; i++) {
2195 int64_t arr_elem = java_elems[i];
2196 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
2197 FREE((void*)arr_elem);
2198 ret->data[i] = arr_elem_conv;
2200 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2205 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2207 CHECK((*env)->GetArrayLength(env, a) == 64);
2208 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2210 LDKCVec_SignatureZ b_constr;
2211 b_constr.datalen = (*env)->GetArrayLength(env, b);
2212 if (b_constr.datalen > 0)
2213 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2215 b_constr.data = NULL;
2216 for (size_t i = 0; i < b_constr.datalen; i++) {
2217 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2218 LDKSignature b_conv_8_ref;
2219 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2220 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2221 b_constr.data[i] = b_conv_8_ref;
2226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2227 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2228 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2229 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2232 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2233 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2234 LDKCVec_SignatureZ b_var = tuple->b;
2235 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2237 for (size_t i = 0; i < b_var.datalen; i++) {
2238 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2239 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2240 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2245 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2248 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2249 CHECK(val->result_ok);
2250 long res_ref = (long)(&(*val->contents.result)) | 1;
2253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2254 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2255 CHECK(!val->result_ok);
2256 return *val->contents.err;
2258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2259 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2262 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2263 CHECK(val->result_ok);
2264 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2265 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2269 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2270 CHECK(!val->result_ok);
2271 return *val->contents.err;
2273 typedef struct LDKSign_JCalls {
2274 atomic_size_t refcnt;
2277 jmethodID get_per_commitment_point_meth;
2278 jmethodID release_commitment_secret_meth;
2279 jmethodID channel_keys_id_meth;
2280 jmethodID sign_counterparty_commitment_meth;
2281 jmethodID sign_holder_commitment_and_htlcs_meth;
2282 jmethodID sign_justice_transaction_meth;
2283 jmethodID sign_counterparty_htlc_transaction_meth;
2284 jmethodID sign_closing_transaction_meth;
2285 jmethodID sign_channel_announcement_meth;
2286 jmethodID ready_channel_meth;
2287 jmethodID write_meth;
2289 static void LDKSign_JCalls_free(void* this_arg) {
2290 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2291 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2294 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2298 LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) {
2299 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2301 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2302 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2304 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2305 LDKPublicKey ret_ref;
2306 CHECK((*env)->GetArrayLength(env, ret) == 33);
2307 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2310 LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) {
2311 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2313 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2314 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2316 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2317 LDKThirtyTwoBytes ret_ref;
2318 CHECK((*env)->GetArrayLength(env, ret) == 32);
2319 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2322 LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) {
2323 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2325 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2326 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2328 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2329 LDKThirtyTwoBytes ret_ref;
2330 CHECK((*env)->GetArrayLength(env, ret) == 32);
2331 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2334 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2335 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2337 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2338 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2339 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2340 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2341 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2342 long commitment_tx_ref = (long)commitment_tx_var.inner;
2343 if (commitment_tx_var.is_owned) {
2344 commitment_tx_ref |= 1;
2346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2348 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2349 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2350 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2353 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2354 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2356 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2357 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2358 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2359 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2360 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2361 long commitment_tx_ref = (long)commitment_tx_var.inner;
2362 if (commitment_tx_var.is_owned) {
2363 commitment_tx_ref |= 1;
2365 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2367 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2368 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2369 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2372 LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2373 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2376 LDKTransaction justice_tx_var = justice_tx;
2377 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2378 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2379 Transaction_free(justice_tx_var);
2380 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2381 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2382 LDKHTLCOutputInCommitment htlc_var = *htlc;
2383 htlc_var = HTLCOutputInCommitment_clone(htlc);
2384 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2385 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2386 long htlc_ref = (long)htlc_var.inner;
2387 if (htlc_var.is_owned) {
2390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2392 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);
2393 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2394 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2397 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2398 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2400 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2401 LDKTransaction htlc_tx_var = htlc_tx;
2402 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2403 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2404 Transaction_free(htlc_tx_var);
2405 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2406 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2407 LDKHTLCOutputInCommitment htlc_var = *htlc;
2408 htlc_var = HTLCOutputInCommitment_clone(htlc);
2409 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2410 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2411 long htlc_ref = (long)htlc_var.inner;
2412 if (htlc_var.is_owned) {
2415 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2417 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);
2418 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2419 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2422 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2423 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2425 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2426 LDKTransaction closing_tx_var = closing_tx;
2427 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2428 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2429 Transaction_free(closing_tx_var);
2430 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2432 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2433 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2434 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2437 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2438 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2440 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2441 LDKUnsignedChannelAnnouncement msg_var = *msg;
2442 msg_var = UnsignedChannelAnnouncement_clone(msg);
2443 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2444 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2445 long msg_ref = (long)msg_var.inner;
2446 if (msg_var.is_owned) {
2449 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2451 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2452 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2453 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2456 void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2457 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2459 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2460 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2461 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2462 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2463 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2464 long channel_parameters_ref = (long)channel_parameters_var.inner;
2465 if (channel_parameters_var.is_owned) {
2466 channel_parameters_ref |= 1;
2468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2470 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2472 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2473 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2476 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2478 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2479 LDKCVec_u8Z ret_ref;
2480 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2481 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2482 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2485 static void* LDKSign_JCalls_clone(const void* this_arg) {
2486 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2487 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2488 return (void*) this_arg;
2490 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2491 jclass c = (*env)->GetObjectClass(env, o);
2493 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2494 atomic_init(&calls->refcnt, 1);
2495 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2496 calls->o = (*env)->NewWeakGlobalRef(env, o);
2497 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2498 CHECK(calls->get_per_commitment_point_meth != NULL);
2499 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2500 CHECK(calls->release_commitment_secret_meth != NULL);
2501 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2502 CHECK(calls->channel_keys_id_meth != NULL);
2503 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2504 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2505 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2506 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2507 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2508 CHECK(calls->sign_justice_transaction_meth != NULL);
2509 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2510 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2511 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2512 CHECK(calls->sign_closing_transaction_meth != NULL);
2513 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2514 CHECK(calls->sign_channel_announcement_meth != NULL);
2515 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2516 CHECK(calls->ready_channel_meth != NULL);
2517 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2518 CHECK(calls->write_meth != NULL);
2520 LDKChannelPublicKeys pubkeys_conv;
2521 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2522 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2523 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2526 .this_arg = (void*) calls,
2527 .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall,
2528 .release_commitment_secret = release_commitment_secret_LDKSign_jcall,
2529 .channel_keys_id = channel_keys_id_LDKSign_jcall,
2530 .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall,
2531 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall,
2532 .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall,
2533 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall,
2534 .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall,
2535 .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall,
2536 .ready_channel = ready_channel_LDKSign_jcall,
2537 .clone = LDKSign_JCalls_clone,
2538 .write = write_LDKSign_jcall,
2539 .free = LDKSign_JCalls_free,
2540 .pubkeys = pubkeys_conv,
2541 .set_pubkeys = NULL,
2545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2546 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2547 *res_ptr = LDKSign_init(env, clz, o, pubkeys);
2548 return (long)res_ptr;
2550 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) {
2551 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2552 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2558 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2559 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2560 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2565 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2566 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2567 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2571 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) {
2572 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2573 LDKCommitmentTransaction commitment_tx_conv;
2574 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2575 commitment_tx_conv.is_owned = false;
2576 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2577 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2578 return (long)ret_conv;
2581 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) {
2582 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2583 LDKHolderCommitmentTransaction commitment_tx_conv;
2584 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2585 commitment_tx_conv.is_owned = false;
2586 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2587 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2588 return (long)ret_conv;
2591 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) {
2592 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2593 LDKTransaction justice_tx_ref;
2594 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2595 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2596 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2597 justice_tx_ref.data_is_owned = true;
2598 unsigned char per_commitment_key_arr[32];
2599 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2600 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2601 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2602 LDKHTLCOutputInCommitment htlc_conv;
2603 htlc_conv.inner = (void*)(htlc & (~1));
2604 htlc_conv.is_owned = false;
2605 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2606 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2607 return (long)ret_conv;
2610 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) {
2611 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2612 LDKTransaction htlc_tx_ref;
2613 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2614 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2615 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2616 htlc_tx_ref.data_is_owned = true;
2617 LDKPublicKey per_commitment_point_ref;
2618 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2619 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2620 LDKHTLCOutputInCommitment htlc_conv;
2621 htlc_conv.inner = (void*)(htlc & (~1));
2622 htlc_conv.is_owned = false;
2623 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2624 *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);
2625 return (long)ret_conv;
2628 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) {
2629 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2630 LDKTransaction closing_tx_ref;
2631 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2632 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2633 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2634 closing_tx_ref.data_is_owned = true;
2635 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2636 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2637 return (long)ret_conv;
2640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2641 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2642 LDKUnsignedChannelAnnouncement msg_conv;
2643 msg_conv.inner = (void*)(msg & (~1));
2644 msg_conv.is_owned = false;
2645 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2646 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2647 return (long)ret_conv;
2650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2651 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2652 LDKChannelTransactionParameters channel_parameters_conv;
2653 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2654 channel_parameters_conv.is_owned = false;
2655 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2659 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2660 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2661 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2662 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2663 CVec_u8Z_free(ret_var);
2667 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2668 if (this_arg->set_pubkeys != NULL)
2669 this_arg->set_pubkeys(this_arg);
2670 return this_arg->pubkeys;
2672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2673 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2674 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2675 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2676 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2677 long ret_ref = (long)ret_var.inner;
2678 if (ret_var.is_owned) {
2684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2685 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2686 LDKThirtyTwoBytes a_ref;
2687 CHECK((*env)->GetArrayLength(env, a) == 32);
2688 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2690 LDKChannelMonitor b_conv;
2691 b_conv.inner = (void*)(b & (~1));
2692 b_conv.is_owned = (b & 1) || (b == 0);
2693 b_conv = ChannelMonitor_clone(&b_conv);
2697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2698 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2699 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2700 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2704 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2705 LDKChannelMonitor b_var = tuple->b;
2706 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2707 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2708 long b_ref = (long)b_var.inner & ~1;
2711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2712 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2715 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2716 CHECK(val->result_ok);
2717 long res_ref = (long)(&(*val->contents.result)) | 1;
2720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2721 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2722 CHECK(!val->result_ok);
2723 LDKDecodeError err_var = (*val->contents.err);
2724 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2725 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2726 long err_ref = (long)err_var.inner & ~1;
2729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2730 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2733 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2734 CHECK(val->result_ok);
2735 long res_ref = ((long)&(*val->contents.result)) | 1;
2736 return (long)res_ref;
2738 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2739 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2740 CHECK(!val->result_ok);
2741 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2744 static jclass LDKAPIError_APIMisuseError_class = NULL;
2745 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2746 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2747 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2748 static jclass LDKAPIError_RouteError_class = NULL;
2749 static jmethodID LDKAPIError_RouteError_meth = NULL;
2750 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2751 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2752 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2753 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2755 LDKAPIError_APIMisuseError_class =
2756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2757 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2758 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2759 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2760 LDKAPIError_FeeRateTooHigh_class =
2761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2762 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2763 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2764 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2765 LDKAPIError_RouteError_class =
2766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2767 CHECK(LDKAPIError_RouteError_class != NULL);
2768 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2769 CHECK(LDKAPIError_RouteError_meth != NULL);
2770 LDKAPIError_ChannelUnavailable_class =
2771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2772 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2773 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2774 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2775 LDKAPIError_MonitorUpdateFailed_class =
2776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2777 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2778 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2779 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2781 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2782 LDKAPIError *obj = (LDKAPIError*)ptr;
2784 case LDKAPIError_APIMisuseError: {
2785 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2786 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2787 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2788 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2790 case LDKAPIError_FeeRateTooHigh: {
2791 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2792 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2793 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2794 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2796 case LDKAPIError_RouteError: {
2797 LDKStr err_str = obj->route_error.err;
2798 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2799 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2801 case LDKAPIError_ChannelUnavailable: {
2802 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2803 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2804 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2805 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2807 case LDKAPIError_MonitorUpdateFailed: {
2808 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2814 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2817 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2818 CHECK(val->result_ok);
2819 return *val->contents.result;
2821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2822 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2823 CHECK(!val->result_ok);
2824 long err_ref = ((long)&(*val->contents.err)) | 1;
2827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2828 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2829 ret->datalen = (*env)->GetArrayLength(env, elems);
2830 if (ret->datalen == 0) {
2833 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2834 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2835 for (size_t i = 0; i < ret->datalen; i++) {
2836 int64_t arr_elem = java_elems[i];
2837 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2838 FREE((void*)arr_elem);
2839 ret->data[i] = arr_elem_conv;
2841 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2845 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2846 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2847 for (size_t i = 0; i < ret.datalen; i++) {
2848 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2853 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2854 ret->datalen = (*env)->GetArrayLength(env, elems);
2855 if (ret->datalen == 0) {
2858 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2859 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2860 for (size_t i = 0; i < ret->datalen; i++) {
2861 int64_t arr_elem = java_elems[i];
2862 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2863 FREE((void*)arr_elem);
2864 ret->data[i] = arr_elem_conv;
2866 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2870 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2871 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2872 for (size_t i = 0; i < ret.datalen; i++) {
2873 ret.data[i] = APIError_clone(&orig->data[i]);
2877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2878 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2879 ret->datalen = (*env)->GetArrayLength(env, elems);
2880 if (ret->datalen == 0) {
2883 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2884 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2885 for (size_t i = 0; i < ret->datalen; i++) {
2886 int64_t arr_elem = java_elems[i];
2887 LDKChannelDetails arr_elem_conv;
2888 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2889 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2890 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2891 ret->data[i] = arr_elem_conv;
2893 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2897 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2898 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2899 for (size_t i = 0; i < ret.datalen; i++) {
2900 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2904 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
2905 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
2906 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
2907 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
2908 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
2909 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
2910 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
2911 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
2912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
2913 LDKPaymentSendFailure_ParameterError_class =
2914 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
2915 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
2916 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "()V");
2917 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
2918 LDKPaymentSendFailure_PathParameterError_class =
2919 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
2920 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
2921 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "()V");
2922 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
2923 LDKPaymentSendFailure_AllFailedRetrySafe_class =
2924 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
2925 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
2926 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "()V");
2927 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
2928 LDKPaymentSendFailure_PartialFailure_class =
2929 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
2930 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
2931 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "()V");
2932 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
2934 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2935 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2937 case LDKPaymentSendFailure_ParameterError: {
2938 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth);
2940 case LDKPaymentSendFailure_PathParameterError: {
2941 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth);
2943 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2944 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth);
2946 case LDKPaymentSendFailure_PartialFailure: {
2947 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth);
2952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2953 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2956 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2957 CHECK(val->result_ok);
2958 return *val->contents.result;
2960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2961 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2962 CHECK(!val->result_ok);
2963 long err_ref = ((long)&(*val->contents.err)) | 1;
2966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2967 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2968 ret->datalen = (*env)->GetArrayLength(env, elems);
2969 if (ret->datalen == 0) {
2972 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2973 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2974 for (size_t i = 0; i < ret->datalen; i++) {
2975 int64_t arr_elem = java_elems[i];
2976 LDKChannelMonitor arr_elem_conv;
2977 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2978 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2979 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2980 ret->data[i] = arr_elem_conv;
2982 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2986 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2987 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2988 for (size_t i = 0; i < ret.datalen; i++) {
2989 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2993 typedef struct LDKWatch_JCalls {
2994 atomic_size_t refcnt;
2997 jmethodID watch_channel_meth;
2998 jmethodID update_channel_meth;
2999 jmethodID release_pending_monitor_events_meth;
3001 static void LDKWatch_JCalls_free(void* this_arg) {
3002 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3003 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3005 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3006 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3010 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3011 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3013 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3014 LDKOutPoint funding_txo_var = funding_txo;
3015 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3016 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3017 long funding_txo_ref = (long)funding_txo_var.inner;
3018 if (funding_txo_var.is_owned) {
3019 funding_txo_ref |= 1;
3021 LDKChannelMonitor monitor_var = monitor;
3022 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3023 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3024 long monitor_ref = (long)monitor_var.inner;
3025 if (monitor_var.is_owned) {
3028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3030 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3031 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3032 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3035 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3036 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3039 LDKOutPoint funding_txo_var = funding_txo;
3040 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3041 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3042 long funding_txo_ref = (long)funding_txo_var.inner;
3043 if (funding_txo_var.is_owned) {
3044 funding_txo_ref |= 1;
3046 LDKChannelMonitorUpdate update_var = update;
3047 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3048 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3049 long update_ref = (long)update_var.inner;
3050 if (update_var.is_owned) {
3053 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3055 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3056 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3057 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3060 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3061 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3063 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3064 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3066 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3067 LDKCVec_MonitorEventZ ret_constr;
3068 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3069 if (ret_constr.datalen > 0)
3070 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3072 ret_constr.data = NULL;
3073 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3074 for (size_t o = 0; o < ret_constr.datalen; o++) {
3075 int64_t ret_conv_14 = ret_vals[o];
3076 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3077 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
3078 ret_constr.data[o] = ret_conv_14_conv;
3080 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3083 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3084 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3085 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3086 return (void*) this_arg;
3088 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3089 jclass c = (*env)->GetObjectClass(env, o);
3091 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3092 atomic_init(&calls->refcnt, 1);
3093 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3094 calls->o = (*env)->NewWeakGlobalRef(env, o);
3095 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3096 CHECK(calls->watch_channel_meth != NULL);
3097 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3098 CHECK(calls->update_channel_meth != NULL);
3099 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3100 CHECK(calls->release_pending_monitor_events_meth != NULL);
3103 .this_arg = (void*) calls,
3104 .watch_channel = watch_channel_LDKWatch_jcall,
3105 .update_channel = update_channel_LDKWatch_jcall,
3106 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3107 .free = LDKWatch_JCalls_free,
3111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3112 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3113 *res_ptr = LDKWatch_init(env, clz, o);
3114 return (long)res_ptr;
3116 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) {
3117 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3118 LDKOutPoint funding_txo_conv;
3119 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3120 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3121 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3122 LDKChannelMonitor monitor_conv;
3123 monitor_conv.inner = (void*)(monitor & (~1));
3124 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3125 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3126 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3127 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3128 return (long)ret_conv;
3131 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) {
3132 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3133 LDKOutPoint funding_txo_conv;
3134 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3135 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3136 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3137 LDKChannelMonitorUpdate update_conv;
3138 update_conv.inner = (void*)(update & (~1));
3139 update_conv.is_owned = (update & 1) || (update == 0);
3140 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3141 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3142 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3143 return (long)ret_conv;
3146 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3147 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3148 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3149 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3150 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3151 for (size_t o = 0; o < ret_var.datalen; o++) {
3152 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3153 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3154 long ret_conv_14_ref = (long)ret_conv_14_copy;
3155 ret_arr_ptr[o] = ret_conv_14_ref;
3157 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3162 typedef struct LDKBroadcasterInterface_JCalls {
3163 atomic_size_t refcnt;
3166 jmethodID broadcast_transaction_meth;
3167 } LDKBroadcasterInterface_JCalls;
3168 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3169 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3170 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3172 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3173 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3177 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3178 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3180 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3181 LDKTransaction tx_var = tx;
3182 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3183 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3184 Transaction_free(tx_var);
3185 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3187 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3189 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3190 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3191 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3192 return (void*) this_arg;
3194 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3195 jclass c = (*env)->GetObjectClass(env, o);
3197 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3198 atomic_init(&calls->refcnt, 1);
3199 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3200 calls->o = (*env)->NewWeakGlobalRef(env, o);
3201 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3202 CHECK(calls->broadcast_transaction_meth != NULL);
3204 LDKBroadcasterInterface ret = {
3205 .this_arg = (void*) calls,
3206 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3207 .free = LDKBroadcasterInterface_JCalls_free,
3211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3212 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3213 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3214 return (long)res_ptr;
3216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3217 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3218 LDKTransaction tx_ref;
3219 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3220 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3221 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3222 tx_ref.data_is_owned = true;
3223 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3227 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3230 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3231 CHECK(val->result_ok);
3232 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3233 *ret = Sign_clone(&(*val->contents.result));
3236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3237 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3238 CHECK(!val->result_ok);
3239 LDKDecodeError err_var = (*val->contents.err);
3240 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3241 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3242 long err_ref = (long)err_var.inner & ~1;
3245 typedef struct LDKKeysInterface_JCalls {
3246 atomic_size_t refcnt;
3249 jmethodID get_node_secret_meth;
3250 jmethodID get_destination_script_meth;
3251 jmethodID get_shutdown_pubkey_meth;
3252 jmethodID get_channel_signer_meth;
3253 jmethodID get_secure_random_bytes_meth;
3254 jmethodID read_chan_signer_meth;
3255 } LDKKeysInterface_JCalls;
3256 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3257 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3258 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3260 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3261 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3265 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3266 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3268 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3269 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3271 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3272 LDKSecretKey ret_ref;
3273 CHECK((*env)->GetArrayLength(env, ret) == 32);
3274 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3277 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3278 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3280 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3281 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3283 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3284 LDKCVec_u8Z ret_ref;
3285 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3286 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3287 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3290 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3291 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3294 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3296 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3297 LDKPublicKey ret_ref;
3298 CHECK((*env)->GetArrayLength(env, ret) == 33);
3299 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3302 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3303 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3305 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3306 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3308 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3309 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3310 ret_conv = Sign_clone(ret);
3313 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3314 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3316 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3317 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3319 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3320 LDKThirtyTwoBytes ret_ref;
3321 CHECK((*env)->GetArrayLength(env, ret) == 32);
3322 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3325 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3326 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3328 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3329 LDKu8slice reader_var = reader;
3330 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3331 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3334 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3335 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3336 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
3339 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3340 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3341 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3342 return (void*) this_arg;
3344 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3345 jclass c = (*env)->GetObjectClass(env, o);
3347 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3348 atomic_init(&calls->refcnt, 1);
3349 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3350 calls->o = (*env)->NewWeakGlobalRef(env, o);
3351 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3352 CHECK(calls->get_node_secret_meth != NULL);
3353 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3354 CHECK(calls->get_destination_script_meth != NULL);
3355 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3356 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3357 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3358 CHECK(calls->get_channel_signer_meth != NULL);
3359 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3360 CHECK(calls->get_secure_random_bytes_meth != NULL);
3361 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3362 CHECK(calls->read_chan_signer_meth != NULL);
3364 LDKKeysInterface ret = {
3365 .this_arg = (void*) calls,
3366 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3367 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3368 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3369 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3370 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3371 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3372 .free = LDKKeysInterface_JCalls_free,
3376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3377 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3378 *res_ptr = LDKKeysInterface_init(env, clz, o);
3379 return (long)res_ptr;
3381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3382 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3383 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3384 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3389 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3390 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3391 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3392 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3393 CVec_u8Z_free(ret_var);
3397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3398 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3399 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3400 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3404 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) {
3405 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3406 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3407 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3412 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3413 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3414 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3419 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3420 LDKu8slice reader_ref;
3421 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3422 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3423 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3424 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3425 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3426 return (long)ret_conv;
3429 typedef struct LDKFeeEstimator_JCalls {
3430 atomic_size_t refcnt;
3433 jmethodID get_est_sat_per_1000_weight_meth;
3434 } LDKFeeEstimator_JCalls;
3435 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3436 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3439 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3440 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3444 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3445 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3447 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3448 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3449 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3451 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3453 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3454 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3455 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3456 return (void*) this_arg;
3458 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3459 jclass c = (*env)->GetObjectClass(env, o);
3461 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3462 atomic_init(&calls->refcnt, 1);
3463 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3464 calls->o = (*env)->NewWeakGlobalRef(env, o);
3465 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
3466 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3468 LDKFeeEstimator ret = {
3469 .this_arg = (void*) calls,
3470 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3471 .free = LDKFeeEstimator_JCalls_free,
3475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3476 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3477 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3478 return (long)res_ptr;
3480 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) {
3481 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3482 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3483 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3487 typedef struct LDKLogger_JCalls {
3488 atomic_size_t refcnt;
3493 static void LDKLogger_JCalls_free(void* this_arg) {
3494 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3495 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3497 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3498 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3502 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3503 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3505 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3506 const char* record_str = record;
3507 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3508 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3510 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3512 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3513 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3514 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3515 return (void*) this_arg;
3517 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3518 jclass c = (*env)->GetObjectClass(env, o);
3520 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3521 atomic_init(&calls->refcnt, 1);
3522 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3523 calls->o = (*env)->NewWeakGlobalRef(env, o);
3524 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3525 CHECK(calls->log_meth != NULL);
3528 .this_arg = (void*) calls,
3529 .log = log_LDKLogger_jcall,
3530 .free = LDKLogger_JCalls_free,
3534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3535 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3536 *res_ptr = LDKLogger_init(env, clz, o);
3537 return (long)res_ptr;
3539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3540 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3541 LDKThirtyTwoBytes a_ref;
3542 CHECK((*env)->GetArrayLength(env, a) == 32);
3543 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3545 LDKChannelManager b_conv;
3546 b_conv.inner = (void*)(b & (~1));
3547 b_conv.is_owned = (b & 1) || (b == 0);
3548 // Warning: we need a move here but no clone is available for LDKChannelManager
3552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3553 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3554 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3555 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3559 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3560 LDKChannelManager b_var = tuple->b;
3561 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3562 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3563 long b_ref = (long)b_var.inner & ~1;
3566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3567 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3570 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3571 CHECK(val->result_ok);
3572 long res_ref = (long)(&(*val->contents.result)) | 1;
3575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3576 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3577 CHECK(!val->result_ok);
3578 LDKDecodeError err_var = (*val->contents.err);
3579 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 long err_ref = (long)err_var.inner & ~1;
3584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3585 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3588 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3589 CHECK(val->result_ok);
3590 long res_ref = ((long)&(*val->contents.result)) | 1;
3593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3594 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3595 CHECK(!val->result_ok);
3596 LDKDecodeError err_var = (*val->contents.err);
3597 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3598 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3599 long err_ref = (long)err_var.inner & ~1;
3602 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3603 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3604 for (size_t i = 0; i < ret.datalen; i++) {
3605 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3610 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3612 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3613 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3614 CHECK(val->result_ok);
3615 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3616 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3618 for (size_t i = 0; i < res_var.datalen; i++) {
3619 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3620 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3621 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3622 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3627 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3628 CHECK(!val->result_ok);
3629 return *val->contents.err;
3631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3632 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3635 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3636 CHECK(val->result_ok);
3637 LDKInMemorySigner res_var = (*val->contents.result);
3638 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3639 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3640 long res_ref = (long)res_var.inner & ~1;
3643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3644 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3645 CHECK(!val->result_ok);
3646 LDKDecodeError err_var = (*val->contents.err);
3647 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3648 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3649 long err_ref = (long)err_var.inner & ~1;
3652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3653 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3654 ret->datalen = (*env)->GetArrayLength(env, elems);
3655 if (ret->datalen == 0) {
3658 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3659 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3660 for (size_t i = 0; i < ret->datalen; i++) {
3661 int64_t arr_elem = java_elems[i];
3662 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3663 FREE((void*)arr_elem);
3664 ret->data[i] = arr_elem_conv;
3666 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3670 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3671 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3672 for (size_t i = 0; i < ret.datalen; i++) {
3673 ret.data[i] = TxOut_clone(&orig->data[i]);
3677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3678 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3681 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3682 CHECK(val->result_ok);
3683 LDKTransaction res_var = (*val->contents.result);
3684 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3685 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3689 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3690 CHECK(!val->result_ok);
3691 return *val->contents.err;
3693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3694 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3695 ret->datalen = (*env)->GetArrayLength(env, elems);
3696 if (ret->datalen == 0) {
3699 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3700 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3701 for (size_t i = 0; i < ret->datalen; i++) {
3702 int64_t arr_elem = java_elems[i];
3703 LDKRouteHop arr_elem_conv;
3704 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3705 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3706 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3707 ret->data[i] = arr_elem_conv;
3709 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3713 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3714 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3715 for (size_t i = 0; i < ret.datalen; i++) {
3716 ret.data[i] = RouteHop_clone(&orig->data[i]);
3720 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3721 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3722 for (size_t i = 0; i < ret.datalen; i++) {
3723 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3728 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3731 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3732 CHECK(val->result_ok);
3733 LDKRoute res_var = (*val->contents.result);
3734 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3735 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3736 long res_ref = (long)res_var.inner & ~1;
3739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3740 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3741 CHECK(!val->result_ok);
3742 LDKDecodeError err_var = (*val->contents.err);
3743 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3744 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3745 long err_ref = (long)err_var.inner & ~1;
3748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3749 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3750 ret->datalen = (*env)->GetArrayLength(env, elems);
3751 if (ret->datalen == 0) {
3754 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3755 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3756 for (size_t i = 0; i < ret->datalen; i++) {
3757 int64_t arr_elem = java_elems[i];
3758 LDKRouteHint arr_elem_conv;
3759 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3760 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3761 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3762 ret->data[i] = arr_elem_conv;
3764 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3768 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3769 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3770 for (size_t i = 0; i < ret.datalen; i++) {
3771 ret.data[i] = RouteHint_clone(&orig->data[i]);
3775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3776 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3779 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3780 CHECK(val->result_ok);
3781 LDKRoute res_var = (*val->contents.result);
3782 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3783 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3784 long res_ref = (long)res_var.inner & ~1;
3787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3788 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3789 CHECK(!val->result_ok);
3790 LDKLightningError err_var = (*val->contents.err);
3791 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3792 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3793 long err_ref = (long)err_var.inner & ~1;
3796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3797 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3800 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3801 CHECK(val->result_ok);
3802 long res_ref = ((long)&(*val->contents.result)) | 1;
3805 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3806 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3807 CHECK(!val->result_ok);
3808 return *val->contents.err;
3810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3811 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3814 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3815 CHECK(val->result_ok);
3816 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3817 *res_conv = (*val->contents.result);
3818 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3819 return (long)res_conv;
3821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3822 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3823 CHECK(!val->result_ok);
3824 LDKDecodeError err_var = (*val->contents.err);
3825 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3826 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3827 long err_ref = (long)err_var.inner & ~1;
3830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3831 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3832 ret->datalen = (*env)->GetArrayLength(env, elems);
3833 if (ret->datalen == 0) {
3836 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3837 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3838 for (size_t i = 0; i < ret->datalen; i++) {
3839 int64_t arr_elem = java_elems[i];
3840 LDKUpdateAddHTLC arr_elem_conv;
3841 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3842 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3843 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3844 ret->data[i] = arr_elem_conv;
3846 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3850 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3851 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3852 for (size_t i = 0; i < ret.datalen; i++) {
3853 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3858 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3859 ret->datalen = (*env)->GetArrayLength(env, elems);
3860 if (ret->datalen == 0) {
3863 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3864 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3865 for (size_t i = 0; i < ret->datalen; i++) {
3866 int64_t arr_elem = java_elems[i];
3867 LDKUpdateFulfillHTLC arr_elem_conv;
3868 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3869 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3870 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3871 ret->data[i] = arr_elem_conv;
3873 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3877 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3878 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3879 for (size_t i = 0; i < ret.datalen; i++) {
3880 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3885 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3886 ret->datalen = (*env)->GetArrayLength(env, elems);
3887 if (ret->datalen == 0) {
3890 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3891 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3892 for (size_t i = 0; i < ret->datalen; i++) {
3893 int64_t arr_elem = java_elems[i];
3894 LDKUpdateFailHTLC arr_elem_conv;
3895 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3896 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3897 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3898 ret->data[i] = arr_elem_conv;
3900 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3904 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3905 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3906 for (size_t i = 0; i < ret.datalen; i++) {
3907 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3912 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3913 ret->datalen = (*env)->GetArrayLength(env, elems);
3914 if (ret->datalen == 0) {
3917 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3918 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3919 for (size_t i = 0; i < ret->datalen; i++) {
3920 int64_t arr_elem = java_elems[i];
3921 LDKUpdateFailMalformedHTLC arr_elem_conv;
3922 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3923 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3924 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3925 ret->data[i] = arr_elem_conv;
3927 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3931 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3932 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3933 for (size_t i = 0; i < ret.datalen; i++) {
3934 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3939 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3942 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3943 CHECK(val->result_ok);
3944 LDKAcceptChannel res_var = (*val->contents.result);
3945 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3946 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3947 long res_ref = (long)res_var.inner & ~1;
3950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3951 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3952 CHECK(!val->result_ok);
3953 LDKDecodeError err_var = (*val->contents.err);
3954 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3955 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3956 long err_ref = (long)err_var.inner & ~1;
3959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3960 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3963 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3964 CHECK(val->result_ok);
3965 LDKAnnouncementSignatures res_var = (*val->contents.result);
3966 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3967 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3968 long res_ref = (long)res_var.inner & ~1;
3971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3972 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3973 CHECK(!val->result_ok);
3974 LDKDecodeError err_var = (*val->contents.err);
3975 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3976 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3977 long err_ref = (long)err_var.inner & ~1;
3980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3981 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3984 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3985 CHECK(val->result_ok);
3986 LDKChannelReestablish res_var = (*val->contents.result);
3987 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3988 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3989 long res_ref = (long)res_var.inner & ~1;
3992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3993 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3994 CHECK(!val->result_ok);
3995 LDKDecodeError err_var = (*val->contents.err);
3996 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3997 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3998 long err_ref = (long)err_var.inner & ~1;
4001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4002 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4005 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4006 CHECK(val->result_ok);
4007 LDKClosingSigned res_var = (*val->contents.result);
4008 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4009 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4010 long res_ref = (long)res_var.inner & ~1;
4013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4014 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4015 CHECK(!val->result_ok);
4016 LDKDecodeError err_var = (*val->contents.err);
4017 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4018 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4019 long err_ref = (long)err_var.inner & ~1;
4022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4023 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4026 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4027 CHECK(val->result_ok);
4028 LDKCommitmentSigned res_var = (*val->contents.result);
4029 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4030 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4031 long res_ref = (long)res_var.inner & ~1;
4034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4035 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4036 CHECK(!val->result_ok);
4037 LDKDecodeError err_var = (*val->contents.err);
4038 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4039 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4040 long err_ref = (long)err_var.inner & ~1;
4043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4044 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4047 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4048 CHECK(val->result_ok);
4049 LDKFundingCreated res_var = (*val->contents.result);
4050 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4051 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4052 long res_ref = (long)res_var.inner & ~1;
4055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4056 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4057 CHECK(!val->result_ok);
4058 LDKDecodeError err_var = (*val->contents.err);
4059 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4060 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4061 long err_ref = (long)err_var.inner & ~1;
4064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4065 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4068 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4069 CHECK(val->result_ok);
4070 LDKFundingSigned res_var = (*val->contents.result);
4071 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4072 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4073 long res_ref = (long)res_var.inner & ~1;
4076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4077 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4078 CHECK(!val->result_ok);
4079 LDKDecodeError err_var = (*val->contents.err);
4080 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4081 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4082 long err_ref = (long)err_var.inner & ~1;
4085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4086 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4089 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4090 CHECK(val->result_ok);
4091 LDKFundingLocked res_var = (*val->contents.result);
4092 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4093 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4094 long res_ref = (long)res_var.inner & ~1;
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4098 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4099 CHECK(!val->result_ok);
4100 LDKDecodeError err_var = (*val->contents.err);
4101 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4102 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4103 long err_ref = (long)err_var.inner & ~1;
4106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4107 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4110 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4111 CHECK(val->result_ok);
4112 LDKInit res_var = (*val->contents.result);
4113 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4114 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4115 long res_ref = (long)res_var.inner & ~1;
4118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4119 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4120 CHECK(!val->result_ok);
4121 LDKDecodeError err_var = (*val->contents.err);
4122 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4123 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4124 long err_ref = (long)err_var.inner & ~1;
4127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4128 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4131 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4132 CHECK(val->result_ok);
4133 LDKOpenChannel res_var = (*val->contents.result);
4134 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4135 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4136 long res_ref = (long)res_var.inner & ~1;
4139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4140 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4141 CHECK(!val->result_ok);
4142 LDKDecodeError err_var = (*val->contents.err);
4143 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4144 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4145 long err_ref = (long)err_var.inner & ~1;
4148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4149 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4152 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4153 CHECK(val->result_ok);
4154 LDKRevokeAndACK res_var = (*val->contents.result);
4155 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4156 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4157 long res_ref = (long)res_var.inner & ~1;
4160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4161 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4162 CHECK(!val->result_ok);
4163 LDKDecodeError err_var = (*val->contents.err);
4164 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4165 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4166 long err_ref = (long)err_var.inner & ~1;
4169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4170 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4173 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4174 CHECK(val->result_ok);
4175 LDKShutdown res_var = (*val->contents.result);
4176 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4177 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4178 long res_ref = (long)res_var.inner & ~1;
4181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4182 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4183 CHECK(!val->result_ok);
4184 LDKDecodeError err_var = (*val->contents.err);
4185 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4186 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4187 long err_ref = (long)err_var.inner & ~1;
4190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4191 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4194 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4195 CHECK(val->result_ok);
4196 LDKUpdateFailHTLC res_var = (*val->contents.result);
4197 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4198 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4199 long res_ref = (long)res_var.inner & ~1;
4202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4203 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4204 CHECK(!val->result_ok);
4205 LDKDecodeError err_var = (*val->contents.err);
4206 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4207 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4208 long err_ref = (long)err_var.inner & ~1;
4211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4212 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4215 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4216 CHECK(val->result_ok);
4217 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4218 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4219 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4220 long res_ref = (long)res_var.inner & ~1;
4223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4224 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4225 CHECK(!val->result_ok);
4226 LDKDecodeError err_var = (*val->contents.err);
4227 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4228 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4229 long err_ref = (long)err_var.inner & ~1;
4232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4233 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4236 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4237 CHECK(val->result_ok);
4238 LDKUpdateFee res_var = (*val->contents.result);
4239 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4240 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4241 long res_ref = (long)res_var.inner & ~1;
4244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4245 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4246 CHECK(!val->result_ok);
4247 LDKDecodeError err_var = (*val->contents.err);
4248 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4249 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4250 long err_ref = (long)err_var.inner & ~1;
4253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4254 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4257 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4258 CHECK(val->result_ok);
4259 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4260 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4261 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4262 long res_ref = (long)res_var.inner & ~1;
4265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4266 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4267 CHECK(!val->result_ok);
4268 LDKDecodeError err_var = (*val->contents.err);
4269 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4270 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4271 long err_ref = (long)err_var.inner & ~1;
4274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4275 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4278 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4279 CHECK(val->result_ok);
4280 LDKUpdateAddHTLC res_var = (*val->contents.result);
4281 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4282 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4283 long res_ref = (long)res_var.inner & ~1;
4286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4287 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4288 CHECK(!val->result_ok);
4289 LDKDecodeError err_var = (*val->contents.err);
4290 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4291 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4292 long err_ref = (long)err_var.inner & ~1;
4295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4296 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4299 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4300 CHECK(val->result_ok);
4301 LDKPing res_var = (*val->contents.result);
4302 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4303 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4304 long res_ref = (long)res_var.inner & ~1;
4307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4308 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4309 CHECK(!val->result_ok);
4310 LDKDecodeError err_var = (*val->contents.err);
4311 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4312 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4313 long err_ref = (long)err_var.inner & ~1;
4316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4317 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4320 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4321 CHECK(val->result_ok);
4322 LDKPong res_var = (*val->contents.result);
4323 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4324 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4325 long res_ref = (long)res_var.inner & ~1;
4328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4329 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4330 CHECK(!val->result_ok);
4331 LDKDecodeError err_var = (*val->contents.err);
4332 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4333 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4334 long err_ref = (long)err_var.inner & ~1;
4337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4338 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4341 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4342 CHECK(val->result_ok);
4343 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4344 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 long res_ref = (long)res_var.inner & ~1;
4349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4350 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4351 CHECK(!val->result_ok);
4352 LDKDecodeError err_var = (*val->contents.err);
4353 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 long err_ref = (long)err_var.inner & ~1;
4358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4359 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4362 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4363 CHECK(val->result_ok);
4364 LDKChannelAnnouncement res_var = (*val->contents.result);
4365 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4366 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4367 long res_ref = (long)res_var.inner & ~1;
4370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4371 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4372 CHECK(!val->result_ok);
4373 LDKDecodeError err_var = (*val->contents.err);
4374 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4375 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4376 long err_ref = (long)err_var.inner & ~1;
4379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4380 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4383 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4384 CHECK(val->result_ok);
4385 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4386 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 long res_ref = (long)res_var.inner & ~1;
4391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4392 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4393 CHECK(!val->result_ok);
4394 LDKDecodeError err_var = (*val->contents.err);
4395 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4396 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4397 long err_ref = (long)err_var.inner & ~1;
4400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4401 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4404 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4405 CHECK(val->result_ok);
4406 LDKChannelUpdate res_var = (*val->contents.result);
4407 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 long res_ref = (long)res_var.inner & ~1;
4412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4413 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4414 CHECK(!val->result_ok);
4415 LDKDecodeError err_var = (*val->contents.err);
4416 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4417 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4418 long err_ref = (long)err_var.inner & ~1;
4421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4422 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4425 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4426 CHECK(val->result_ok);
4427 LDKErrorMessage res_var = (*val->contents.result);
4428 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4429 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4430 long res_ref = (long)res_var.inner & ~1;
4433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4434 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4435 CHECK(!val->result_ok);
4436 LDKDecodeError err_var = (*val->contents.err);
4437 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4438 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4439 long err_ref = (long)err_var.inner & ~1;
4442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4443 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4446 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4447 CHECK(val->result_ok);
4448 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4449 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4450 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4451 long res_ref = (long)res_var.inner & ~1;
4454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4455 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4456 CHECK(!val->result_ok);
4457 LDKDecodeError err_var = (*val->contents.err);
4458 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4459 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4460 long err_ref = (long)err_var.inner & ~1;
4463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4464 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4467 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4468 CHECK(val->result_ok);
4469 LDKNodeAnnouncement res_var = (*val->contents.result);
4470 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4471 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4472 long res_ref = (long)res_var.inner & ~1;
4475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4476 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4477 CHECK(!val->result_ok);
4478 LDKDecodeError err_var = (*val->contents.err);
4479 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4480 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4481 long err_ref = (long)err_var.inner & ~1;
4484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4485 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4488 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4489 CHECK(val->result_ok);
4490 LDKQueryShortChannelIds res_var = (*val->contents.result);
4491 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4492 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4493 long res_ref = (long)res_var.inner & ~1;
4496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4497 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4498 CHECK(!val->result_ok);
4499 LDKDecodeError err_var = (*val->contents.err);
4500 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4501 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4502 long err_ref = (long)err_var.inner & ~1;
4505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4506 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4509 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4510 CHECK(val->result_ok);
4511 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4512 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4513 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4514 long res_ref = (long)res_var.inner & ~1;
4517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4518 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4519 CHECK(!val->result_ok);
4520 LDKDecodeError err_var = (*val->contents.err);
4521 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4522 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4523 long err_ref = (long)err_var.inner & ~1;
4526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4527 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4530 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4531 CHECK(val->result_ok);
4532 LDKQueryChannelRange res_var = (*val->contents.result);
4533 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4534 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4535 long res_ref = (long)res_var.inner & ~1;
4538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4539 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4540 CHECK(!val->result_ok);
4541 LDKDecodeError err_var = (*val->contents.err);
4542 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4543 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4544 long err_ref = (long)err_var.inner & ~1;
4547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4548 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4551 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4552 CHECK(val->result_ok);
4553 LDKReplyChannelRange res_var = (*val->contents.result);
4554 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4555 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4556 long res_ref = (long)res_var.inner & ~1;
4559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4560 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4561 CHECK(!val->result_ok);
4562 LDKDecodeError err_var = (*val->contents.err);
4563 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4564 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4565 long err_ref = (long)err_var.inner & ~1;
4568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4569 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4572 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4573 CHECK(val->result_ok);
4574 LDKGossipTimestampFilter res_var = (*val->contents.result);
4575 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4576 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4577 long res_ref = (long)res_var.inner & ~1;
4580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4581 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4582 CHECK(!val->result_ok);
4583 LDKDecodeError err_var = (*val->contents.err);
4584 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4585 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4586 long err_ref = (long)err_var.inner & ~1;
4589 typedef struct LDKMessageSendEventsProvider_JCalls {
4590 atomic_size_t refcnt;
4593 jmethodID get_and_clear_pending_msg_events_meth;
4594 } LDKMessageSendEventsProvider_JCalls;
4595 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4596 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4597 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4599 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4600 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4604 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4605 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4607 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4608 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4610 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
4611 LDKCVec_MessageSendEventZ ret_constr;
4612 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4613 if (ret_constr.datalen > 0)
4614 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4616 ret_constr.data = NULL;
4617 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4618 for (size_t s = 0; s < ret_constr.datalen; s++) {
4619 int64_t ret_conv_18 = ret_vals[s];
4620 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4621 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
4622 ret_constr.data[s] = ret_conv_18_conv;
4624 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4627 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4628 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4629 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4630 return (void*) this_arg;
4632 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4633 jclass c = (*env)->GetObjectClass(env, o);
4635 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4636 atomic_init(&calls->refcnt, 1);
4637 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4638 calls->o = (*env)->NewWeakGlobalRef(env, o);
4639 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
4640 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
4642 LDKMessageSendEventsProvider ret = {
4643 .this_arg = (void*) calls,
4644 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4645 .free = LDKMessageSendEventsProvider_JCalls_free,
4649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4650 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4651 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
4652 return (long)res_ptr;
4654 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4655 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4656 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4657 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4658 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4659 for (size_t s = 0; s < ret_var.datalen; s++) {
4660 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4661 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4662 long ret_conv_18_ref = (long)ret_conv_18_copy;
4663 ret_arr_ptr[s] = ret_conv_18_ref;
4665 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4670 typedef struct LDKEventsProvider_JCalls {
4671 atomic_size_t refcnt;
4674 jmethodID get_and_clear_pending_events_meth;
4675 } LDKEventsProvider_JCalls;
4676 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4677 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4678 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4680 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4681 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4685 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
4686 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4688 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4689 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4691 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
4692 LDKCVec_EventZ ret_constr;
4693 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4694 if (ret_constr.datalen > 0)
4695 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4697 ret_constr.data = NULL;
4698 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4699 for (size_t h = 0; h < ret_constr.datalen; h++) {
4700 int64_t ret_conv_7 = ret_vals[h];
4701 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4702 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
4703 ret_constr.data[h] = ret_conv_7_conv;
4705 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4708 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4709 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4710 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4711 return (void*) this_arg;
4713 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4714 jclass c = (*env)->GetObjectClass(env, o);
4716 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4717 atomic_init(&calls->refcnt, 1);
4718 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4719 calls->o = (*env)->NewWeakGlobalRef(env, o);
4720 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
4721 CHECK(calls->get_and_clear_pending_events_meth != NULL);
4723 LDKEventsProvider ret = {
4724 .this_arg = (void*) calls,
4725 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
4726 .free = LDKEventsProvider_JCalls_free,
4730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4731 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4732 *res_ptr = LDKEventsProvider_init(env, clz, o);
4733 return (long)res_ptr;
4735 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4736 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4737 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4738 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4739 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4740 for (size_t h = 0; h < ret_var.datalen; h++) {
4741 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4742 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4743 long ret_conv_7_ref = (long)ret_conv_7_copy;
4744 ret_arr_ptr[h] = ret_conv_7_ref;
4746 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4751 typedef struct LDKAccess_JCalls {
4752 atomic_size_t refcnt;
4755 jmethodID get_utxo_meth;
4757 static void LDKAccess_JCalls_free(void* this_arg) {
4758 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4759 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4761 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4762 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4766 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4767 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4769 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4770 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4771 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4772 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4774 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4775 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4776 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4779 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4780 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4781 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4782 return (void*) this_arg;
4784 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4785 jclass c = (*env)->GetObjectClass(env, o);
4787 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4788 atomic_init(&calls->refcnt, 1);
4789 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4790 calls->o = (*env)->NewWeakGlobalRef(env, o);
4791 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4792 CHECK(calls->get_utxo_meth != NULL);
4795 .this_arg = (void*) calls,
4796 .get_utxo = get_utxo_LDKAccess_jcall,
4797 .free = LDKAccess_JCalls_free,
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4802 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4803 *res_ptr = LDKAccess_init(env, clz, o);
4804 return (long)res_ptr;
4806 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) {
4807 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4808 unsigned char genesis_hash_arr[32];
4809 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4810 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4811 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4812 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4813 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4814 return (long)ret_conv;
4817 typedef struct LDKListen_JCalls {
4818 atomic_size_t refcnt;
4821 jmethodID block_connected_meth;
4822 jmethodID block_disconnected_meth;
4824 static void LDKListen_JCalls_free(void* this_arg) {
4825 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4826 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4828 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4829 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4833 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4834 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4837 LDKu8slice block_var = block;
4838 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
4839 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
4840 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4842 return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
4844 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4845 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4847 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4848 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
4849 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
4850 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4852 return (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
4854 static void* LDKListen_JCalls_clone(const void* this_arg) {
4855 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4856 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4857 return (void*) this_arg;
4859 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
4860 jclass c = (*env)->GetObjectClass(env, o);
4862 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4863 atomic_init(&calls->refcnt, 1);
4864 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4865 calls->o = (*env)->NewWeakGlobalRef(env, o);
4866 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
4867 CHECK(calls->block_connected_meth != NULL);
4868 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
4869 CHECK(calls->block_disconnected_meth != NULL);
4872 .this_arg = (void*) calls,
4873 .block_connected = block_connected_LDKListen_jcall,
4874 .block_disconnected = block_disconnected_LDKListen_jcall,
4875 .free = LDKListen_JCalls_free,
4879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
4880 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4881 *res_ptr = LDKListen_init(env, clz, o);
4882 return (long)res_ptr;
4884 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) {
4885 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4886 LDKu8slice block_ref;
4887 block_ref.datalen = (*env)->GetArrayLength(env, block);
4888 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
4889 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4890 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
4893 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) {
4894 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4895 unsigned char header_arr[80];
4896 CHECK((*env)->GetArrayLength(env, header) == 80);
4897 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
4898 unsigned char (*header_ref)[80] = &header_arr;
4899 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4902 typedef struct LDKFilter_JCalls {
4903 atomic_size_t refcnt;
4906 jmethodID register_tx_meth;
4907 jmethodID register_output_meth;
4909 static void LDKFilter_JCalls_free(void* this_arg) {
4910 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4911 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4913 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4914 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4918 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4919 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4921 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4922 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4923 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4924 LDKu8slice script_pubkey_var = script_pubkey;
4925 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4926 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4929 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4931 void register_output_LDKFilter_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4932 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4934 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4935 LDKOutPoint outpoint_var = *outpoint;
4936 outpoint_var = OutPoint_clone(outpoint);
4937 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4938 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4939 long outpoint_ref = (long)outpoint_var.inner;
4940 if (outpoint_var.is_owned) {
4943 LDKu8slice script_pubkey_var = script_pubkey;
4944 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4945 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4946 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4948 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4950 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4951 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4952 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4953 return (void*) this_arg;
4955 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4956 jclass c = (*env)->GetObjectClass(env, o);
4958 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4959 atomic_init(&calls->refcnt, 1);
4960 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4961 calls->o = (*env)->NewWeakGlobalRef(env, o);
4962 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4963 CHECK(calls->register_tx_meth != NULL);
4964 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4965 CHECK(calls->register_output_meth != NULL);
4968 .this_arg = (void*) calls,
4969 .register_tx = register_tx_LDKFilter_jcall,
4970 .register_output = register_output_LDKFilter_jcall,
4971 .free = LDKFilter_JCalls_free,
4975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4976 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4977 *res_ptr = LDKFilter_init(env, clz, o);
4978 return (long)res_ptr;
4980 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) {
4981 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4982 unsigned char txid_arr[32];
4983 CHECK((*env)->GetArrayLength(env, txid) == 32);
4984 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4985 unsigned char (*txid_ref)[32] = &txid_arr;
4986 LDKu8slice script_pubkey_ref;
4987 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4988 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4989 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4990 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4993 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) {
4994 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4995 LDKOutPoint outpoint_conv;
4996 outpoint_conv.inner = (void*)(outpoint & (~1));
4997 outpoint_conv.is_owned = false;
4998 LDKu8slice script_pubkey_ref;
4999 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
5000 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
5001 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
5002 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
5005 typedef struct LDKPersist_JCalls {
5006 atomic_size_t refcnt;
5009 jmethodID persist_new_channel_meth;
5010 jmethodID update_persisted_channel_meth;
5011 } LDKPersist_JCalls;
5012 static void LDKPersist_JCalls_free(void* this_arg) {
5013 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5014 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5016 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5017 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5021 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5022 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5024 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5025 LDKOutPoint id_var = id;
5026 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5027 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5028 long id_ref = (long)id_var.inner;
5029 if (id_var.is_owned) {
5032 LDKChannelMonitor data_var = *data;
5033 data_var = ChannelMonitor_clone(data);
5034 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5035 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5036 long data_ref = (long)data_var.inner;
5037 if (data_var.is_owned) {
5040 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5042 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
5043 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5044 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5047 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5048 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5050 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5051 LDKOutPoint id_var = id;
5052 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5053 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5054 long id_ref = (long)id_var.inner;
5055 if (id_var.is_owned) {
5058 LDKChannelMonitorUpdate update_var = *update;
5059 update_var = ChannelMonitorUpdate_clone(update);
5060 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5061 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5062 long update_ref = (long)update_var.inner;
5063 if (update_var.is_owned) {
5066 LDKChannelMonitor data_var = *data;
5067 data_var = ChannelMonitor_clone(data);
5068 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5069 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5070 long data_ref = (long)data_var.inner;
5071 if (data_var.is_owned) {
5074 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5076 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5077 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5078 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5081 static void* LDKPersist_JCalls_clone(const void* this_arg) {
5082 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5083 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5084 return (void*) this_arg;
5086 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
5087 jclass c = (*env)->GetObjectClass(env, o);
5089 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5090 atomic_init(&calls->refcnt, 1);
5091 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5092 calls->o = (*env)->NewWeakGlobalRef(env, o);
5093 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
5094 CHECK(calls->persist_new_channel_meth != NULL);
5095 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
5096 CHECK(calls->update_persisted_channel_meth != NULL);
5099 .this_arg = (void*) calls,
5100 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5101 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5102 .free = LDKPersist_JCalls_free,
5106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
5107 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5108 *res_ptr = LDKPersist_init(env, clz, o);
5109 return (long)res_ptr;
5111 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) {
5112 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5113 LDKOutPoint id_conv;
5114 id_conv.inner = (void*)(id & (~1));
5115 id_conv.is_owned = (id & 1) || (id == 0);
5116 id_conv = OutPoint_clone(&id_conv);
5117 LDKChannelMonitor data_conv;
5118 data_conv.inner = (void*)(data & (~1));
5119 data_conv.is_owned = false;
5120 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5121 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5122 return (long)ret_conv;
5125 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) {
5126 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5127 LDKOutPoint id_conv;
5128 id_conv.inner = (void*)(id & (~1));
5129 id_conv.is_owned = (id & 1) || (id == 0);
5130 id_conv = OutPoint_clone(&id_conv);
5131 LDKChannelMonitorUpdate update_conv;
5132 update_conv.inner = (void*)(update & (~1));
5133 update_conv.is_owned = false;
5134 LDKChannelMonitor data_conv;
5135 data_conv.inner = (void*)(data & (~1));
5136 data_conv.is_owned = false;
5137 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5138 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5139 return (long)ret_conv;
5142 typedef struct LDKChannelMessageHandler_JCalls {
5143 atomic_size_t refcnt;
5146 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5147 jmethodID handle_open_channel_meth;
5148 jmethodID handle_accept_channel_meth;
5149 jmethodID handle_funding_created_meth;
5150 jmethodID handle_funding_signed_meth;
5151 jmethodID handle_funding_locked_meth;
5152 jmethodID handle_shutdown_meth;
5153 jmethodID handle_closing_signed_meth;
5154 jmethodID handle_update_add_htlc_meth;
5155 jmethodID handle_update_fulfill_htlc_meth;
5156 jmethodID handle_update_fail_htlc_meth;
5157 jmethodID handle_update_fail_malformed_htlc_meth;
5158 jmethodID handle_commitment_signed_meth;
5159 jmethodID handle_revoke_and_ack_meth;
5160 jmethodID handle_update_fee_meth;
5161 jmethodID handle_announcement_signatures_meth;
5162 jmethodID peer_disconnected_meth;
5163 jmethodID peer_connected_meth;
5164 jmethodID handle_channel_reestablish_meth;
5165 jmethodID handle_channel_update_meth;
5166 jmethodID handle_error_meth;
5167 } LDKChannelMessageHandler_JCalls;
5168 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5169 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5170 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5172 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5173 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5177 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5178 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5180 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5181 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5182 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5183 LDKInitFeatures their_features_var = their_features;
5184 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5185 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5186 long their_features_ref = (long)their_features_var.inner;
5187 if (their_features_var.is_owned) {
5188 their_features_ref |= 1;
5190 LDKOpenChannel msg_var = *msg;
5191 msg_var = OpenChannel_clone(msg);
5192 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5193 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5194 long msg_ref = (long)msg_var.inner;
5195 if (msg_var.is_owned) {
5198 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5200 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5202 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5203 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5205 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5206 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5207 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5208 LDKInitFeatures their_features_var = their_features;
5209 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5210 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5211 long their_features_ref = (long)their_features_var.inner;
5212 if (their_features_var.is_owned) {
5213 their_features_ref |= 1;
5215 LDKAcceptChannel msg_var = *msg;
5216 msg_var = AcceptChannel_clone(msg);
5217 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5218 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5219 long msg_ref = (long)msg_var.inner;
5220 if (msg_var.is_owned) {
5223 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5225 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5227 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5228 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5230 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5231 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5232 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5233 LDKFundingCreated msg_var = *msg;
5234 msg_var = FundingCreated_clone(msg);
5235 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5236 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5237 long msg_ref = (long)msg_var.inner;
5238 if (msg_var.is_owned) {
5241 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5243 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5245 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5246 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5248 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5249 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5250 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5251 LDKFundingSigned msg_var = *msg;
5252 msg_var = FundingSigned_clone(msg);
5253 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5254 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5255 long msg_ref = (long)msg_var.inner;
5256 if (msg_var.is_owned) {
5259 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5261 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5263 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5264 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5266 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5267 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5268 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5269 LDKFundingLocked msg_var = *msg;
5270 msg_var = FundingLocked_clone(msg);
5271 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5272 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5273 long msg_ref = (long)msg_var.inner;
5274 if (msg_var.is_owned) {
5277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5279 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5281 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5282 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5284 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5285 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5286 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5287 LDKInitFeatures their_features_var = *their_features;
5288 their_features_var = InitFeatures_clone(their_features);
5289 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5290 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5291 long their_features_ref = (long)their_features_var.inner;
5292 if (their_features_var.is_owned) {
5293 their_features_ref |= 1;
5295 LDKShutdown msg_var = *msg;
5296 msg_var = Shutdown_clone(msg);
5297 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5298 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5299 long msg_ref = (long)msg_var.inner;
5300 if (msg_var.is_owned) {
5303 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5305 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5307 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5308 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5310 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5311 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5312 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5313 LDKClosingSigned msg_var = *msg;
5314 msg_var = ClosingSigned_clone(msg);
5315 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5316 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5317 long msg_ref = (long)msg_var.inner;
5318 if (msg_var.is_owned) {
5321 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5323 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5325 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5326 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5328 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5329 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5330 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5331 LDKUpdateAddHTLC msg_var = *msg;
5332 msg_var = UpdateAddHTLC_clone(msg);
5333 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5334 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5335 long msg_ref = (long)msg_var.inner;
5336 if (msg_var.is_owned) {
5339 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5341 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5343 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5346 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5347 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5348 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5349 LDKUpdateFulfillHTLC msg_var = *msg;
5350 msg_var = UpdateFulfillHTLC_clone(msg);
5351 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5352 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5353 long msg_ref = (long)msg_var.inner;
5354 if (msg_var.is_owned) {
5357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5359 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5361 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5362 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5364 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5365 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5366 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5367 LDKUpdateFailHTLC msg_var = *msg;
5368 msg_var = UpdateFailHTLC_clone(msg);
5369 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5370 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5371 long msg_ref = (long)msg_var.inner;
5372 if (msg_var.is_owned) {
5375 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5377 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5379 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5380 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5382 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5383 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5384 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5385 LDKUpdateFailMalformedHTLC msg_var = *msg;
5386 msg_var = UpdateFailMalformedHTLC_clone(msg);
5387 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5388 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5389 long msg_ref = (long)msg_var.inner;
5390 if (msg_var.is_owned) {
5393 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5395 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5397 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5398 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5400 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5401 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5402 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5403 LDKCommitmentSigned msg_var = *msg;
5404 msg_var = CommitmentSigned_clone(msg);
5405 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5406 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5407 long msg_ref = (long)msg_var.inner;
5408 if (msg_var.is_owned) {
5411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5413 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5415 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5416 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5418 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5419 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5420 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5421 LDKRevokeAndACK msg_var = *msg;
5422 msg_var = RevokeAndACK_clone(msg);
5423 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5424 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5425 long msg_ref = (long)msg_var.inner;
5426 if (msg_var.is_owned) {
5429 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5431 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5433 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5434 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5436 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5437 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5438 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5439 LDKUpdateFee msg_var = *msg;
5440 msg_var = UpdateFee_clone(msg);
5441 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5442 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5443 long msg_ref = (long)msg_var.inner;
5444 if (msg_var.is_owned) {
5447 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5449 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5451 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5452 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5454 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5455 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5456 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5457 LDKAnnouncementSignatures msg_var = *msg;
5458 msg_var = AnnouncementSignatures_clone(msg);
5459 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5460 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5461 long msg_ref = (long)msg_var.inner;
5462 if (msg_var.is_owned) {
5465 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5467 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5469 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5470 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5472 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5473 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5474 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5477 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5479 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5480 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5482 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5483 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5484 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5485 LDKInit msg_var = *msg;
5486 msg_var = Init_clone(msg);
5487 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5488 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5489 long msg_ref = (long)msg_var.inner;
5490 if (msg_var.is_owned) {
5493 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5495 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5497 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5498 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5500 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5501 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5502 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5503 LDKChannelReestablish msg_var = *msg;
5504 msg_var = ChannelReestablish_clone(msg);
5505 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5506 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5507 long msg_ref = (long)msg_var.inner;
5508 if (msg_var.is_owned) {
5511 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5513 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5515 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
5516 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5518 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5519 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5520 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5521 LDKChannelUpdate msg_var = *msg;
5522 msg_var = ChannelUpdate_clone(msg);
5523 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5524 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5525 long msg_ref = (long)msg_var.inner;
5526 if (msg_var.is_owned) {
5529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5531 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
5533 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5534 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5536 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5537 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5538 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5539 LDKErrorMessage msg_var = *msg;
5540 msg_var = ErrorMessage_clone(msg);
5541 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5542 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5543 long msg_ref = (long)msg_var.inner;
5544 if (msg_var.is_owned) {
5547 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5549 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5551 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
5552 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5553 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5554 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5555 return (void*) this_arg;
5557 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5558 jclass c = (*env)->GetObjectClass(env, o);
5560 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5561 atomic_init(&calls->refcnt, 1);
5562 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5563 calls->o = (*env)->NewWeakGlobalRef(env, o);
5564 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
5565 CHECK(calls->handle_open_channel_meth != NULL);
5566 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
5567 CHECK(calls->handle_accept_channel_meth != NULL);
5568 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
5569 CHECK(calls->handle_funding_created_meth != NULL);
5570 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
5571 CHECK(calls->handle_funding_signed_meth != NULL);
5572 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
5573 CHECK(calls->handle_funding_locked_meth != NULL);
5574 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
5575 CHECK(calls->handle_shutdown_meth != NULL);
5576 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
5577 CHECK(calls->handle_closing_signed_meth != NULL);
5578 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
5579 CHECK(calls->handle_update_add_htlc_meth != NULL);
5580 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
5581 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
5582 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
5583 CHECK(calls->handle_update_fail_htlc_meth != NULL);
5584 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
5585 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
5586 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
5587 CHECK(calls->handle_commitment_signed_meth != NULL);
5588 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
5589 CHECK(calls->handle_revoke_and_ack_meth != NULL);
5590 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
5591 CHECK(calls->handle_update_fee_meth != NULL);
5592 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
5593 CHECK(calls->handle_announcement_signatures_meth != NULL);
5594 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
5595 CHECK(calls->peer_disconnected_meth != NULL);
5596 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
5597 CHECK(calls->peer_connected_meth != NULL);
5598 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
5599 CHECK(calls->handle_channel_reestablish_meth != NULL);
5600 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
5601 CHECK(calls->handle_channel_update_meth != NULL);
5602 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
5603 CHECK(calls->handle_error_meth != NULL);
5605 LDKChannelMessageHandler ret = {
5606 .this_arg = (void*) calls,
5607 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
5608 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
5609 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
5610 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
5611 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
5612 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
5613 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
5614 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
5615 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
5616 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
5617 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
5618 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
5619 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
5620 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
5621 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
5622 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
5623 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
5624 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
5625 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
5626 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
5627 .free = LDKChannelMessageHandler_JCalls_free,
5628 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5630 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5634 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5635 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5636 return (long)res_ptr;
5638 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) {
5639 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5640 LDKPublicKey their_node_id_ref;
5641 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5642 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5643 LDKInitFeatures their_features_conv;
5644 their_features_conv.inner = (void*)(their_features & (~1));
5645 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5646 their_features_conv = InitFeatures_clone(&their_features_conv);
5647 LDKOpenChannel msg_conv;
5648 msg_conv.inner = (void*)(msg & (~1));
5649 msg_conv.is_owned = false;
5650 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5653 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) {
5654 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5655 LDKPublicKey their_node_id_ref;
5656 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5657 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5658 LDKInitFeatures their_features_conv;
5659 their_features_conv.inner = (void*)(their_features & (~1));
5660 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5661 their_features_conv = InitFeatures_clone(&their_features_conv);
5662 LDKAcceptChannel msg_conv;
5663 msg_conv.inner = (void*)(msg & (~1));
5664 msg_conv.is_owned = false;
5665 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5668 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) {
5669 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5670 LDKPublicKey their_node_id_ref;
5671 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5672 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5673 LDKFundingCreated msg_conv;
5674 msg_conv.inner = (void*)(msg & (~1));
5675 msg_conv.is_owned = false;
5676 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5679 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) {
5680 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5681 LDKPublicKey their_node_id_ref;
5682 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5683 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5684 LDKFundingSigned msg_conv;
5685 msg_conv.inner = (void*)(msg & (~1));
5686 msg_conv.is_owned = false;
5687 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5690 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) {
5691 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5692 LDKPublicKey their_node_id_ref;
5693 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5694 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5695 LDKFundingLocked msg_conv;
5696 msg_conv.inner = (void*)(msg & (~1));
5697 msg_conv.is_owned = false;
5698 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5701 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) {
5702 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5703 LDKPublicKey their_node_id_ref;
5704 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5705 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5706 LDKInitFeatures their_features_conv;
5707 their_features_conv.inner = (void*)(their_features & (~1));
5708 their_features_conv.is_owned = false;
5709 LDKShutdown msg_conv;
5710 msg_conv.inner = (void*)(msg & (~1));
5711 msg_conv.is_owned = false;
5712 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5715 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) {
5716 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5717 LDKPublicKey their_node_id_ref;
5718 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5719 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5720 LDKClosingSigned msg_conv;
5721 msg_conv.inner = (void*)(msg & (~1));
5722 msg_conv.is_owned = false;
5723 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5726 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) {
5727 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5728 LDKPublicKey their_node_id_ref;
5729 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5730 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5731 LDKUpdateAddHTLC msg_conv;
5732 msg_conv.inner = (void*)(msg & (~1));
5733 msg_conv.is_owned = false;
5734 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5737 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) {
5738 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5739 LDKPublicKey their_node_id_ref;
5740 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5741 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5742 LDKUpdateFulfillHTLC msg_conv;
5743 msg_conv.inner = (void*)(msg & (~1));
5744 msg_conv.is_owned = false;
5745 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5748 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) {
5749 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5750 LDKPublicKey their_node_id_ref;
5751 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5752 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5753 LDKUpdateFailHTLC msg_conv;
5754 msg_conv.inner = (void*)(msg & (~1));
5755 msg_conv.is_owned = false;
5756 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5759 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) {
5760 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5761 LDKPublicKey their_node_id_ref;
5762 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5763 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5764 LDKUpdateFailMalformedHTLC msg_conv;
5765 msg_conv.inner = (void*)(msg & (~1));
5766 msg_conv.is_owned = false;
5767 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5770 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) {
5771 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5772 LDKPublicKey their_node_id_ref;
5773 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5774 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5775 LDKCommitmentSigned msg_conv;
5776 msg_conv.inner = (void*)(msg & (~1));
5777 msg_conv.is_owned = false;
5778 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5781 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) {
5782 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5783 LDKPublicKey their_node_id_ref;
5784 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5785 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5786 LDKRevokeAndACK msg_conv;
5787 msg_conv.inner = (void*)(msg & (~1));
5788 msg_conv.is_owned = false;
5789 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5792 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) {
5793 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5794 LDKPublicKey their_node_id_ref;
5795 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5796 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5797 LDKUpdateFee msg_conv;
5798 msg_conv.inner = (void*)(msg & (~1));
5799 msg_conv.is_owned = false;
5800 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5803 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) {
5804 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5805 LDKPublicKey their_node_id_ref;
5806 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5807 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5808 LDKAnnouncementSignatures msg_conv;
5809 msg_conv.inner = (void*)(msg & (~1));
5810 msg_conv.is_owned = false;
5811 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5814 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) {
5815 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5816 LDKPublicKey their_node_id_ref;
5817 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5818 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5819 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5822 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) {
5823 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5824 LDKPublicKey their_node_id_ref;
5825 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5826 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5828 msg_conv.inner = (void*)(msg & (~1));
5829 msg_conv.is_owned = false;
5830 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5833 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) {
5834 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5835 LDKPublicKey their_node_id_ref;
5836 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5837 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5838 LDKChannelReestablish msg_conv;
5839 msg_conv.inner = (void*)(msg & (~1));
5840 msg_conv.is_owned = false;
5841 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5845 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5846 LDKPublicKey their_node_id_ref;
5847 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5848 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5849 LDKChannelUpdate msg_conv;
5850 msg_conv.inner = (void*)(msg & (~1));
5851 msg_conv.is_owned = false;
5852 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5855 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) {
5856 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5857 LDKPublicKey their_node_id_ref;
5858 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5859 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5860 LDKErrorMessage msg_conv;
5861 msg_conv.inner = (void*)(msg & (~1));
5862 msg_conv.is_owned = false;
5863 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5866 typedef struct LDKRoutingMessageHandler_JCalls {
5867 atomic_size_t refcnt;
5870 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5871 jmethodID handle_node_announcement_meth;
5872 jmethodID handle_channel_announcement_meth;
5873 jmethodID handle_channel_update_meth;
5874 jmethodID handle_htlc_fail_channel_update_meth;
5875 jmethodID get_next_channel_announcements_meth;
5876 jmethodID get_next_node_announcements_meth;
5877 jmethodID sync_routing_table_meth;
5878 jmethodID handle_reply_channel_range_meth;
5879 jmethodID handle_reply_short_channel_ids_end_meth;
5880 jmethodID handle_query_channel_range_meth;
5881 jmethodID handle_query_short_channel_ids_meth;
5882 } LDKRoutingMessageHandler_JCalls;
5883 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5884 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5885 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5887 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5888 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5892 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5893 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5895 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5896 LDKNodeAnnouncement msg_var = *msg;
5897 msg_var = NodeAnnouncement_clone(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_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5907 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5908 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5911 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * 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 LDKChannelAnnouncement msg_var = *msg;
5916 msg_var = ChannelAnnouncement_clone(msg);
5917 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5918 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5919 long msg_ref = (long)msg_var.inner;
5920 if (msg_var.is_owned) {
5923 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5925 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5926 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5927 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5930 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5931 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5933 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5934 LDKChannelUpdate msg_var = *msg;
5935 msg_var = ChannelUpdate_clone(msg);
5936 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5937 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5938 long msg_ref = (long)msg_var.inner;
5939 if (msg_var.is_owned) {
5942 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5944 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5945 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5946 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5949 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5950 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5952 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5953 long ret_update = (long)update;
5954 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5956 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5958 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5959 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5961 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5962 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5964 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5965 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5966 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5967 if (ret_constr.datalen > 0)
5968 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5970 ret_constr.data = NULL;
5971 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5972 for (size_t l = 0; l < ret_constr.datalen; l++) {
5973 int64_t ret_conv_63 = ret_vals[l];
5974 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5975 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
5976 ret_constr.data[l] = ret_conv_63_conv;
5978 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5981 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5982 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5984 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5985 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5986 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5987 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5989 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5990 LDKCVec_NodeAnnouncementZ ret_constr;
5991 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5992 if (ret_constr.datalen > 0)
5993 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5995 ret_constr.data = NULL;
5996 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5997 for (size_t s = 0; s < ret_constr.datalen; s++) {
5998 int64_t ret_conv_18 = ret_vals[s];
5999 LDKNodeAnnouncement ret_conv_18_conv;
6000 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6001 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6002 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6003 ret_constr.data[s] = ret_conv_18_conv;
6005 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6008 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6009 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6011 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6012 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6013 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6014 LDKInit init_var = *init;
6015 init_var = Init_clone(init);
6016 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6017 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6018 long init_ref = (long)init_var.inner;
6019 if (init_var.is_owned) {
6022 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6024 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6026 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6027 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6029 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6030 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6031 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6032 LDKReplyChannelRange msg_var = msg;
6033 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6034 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6035 long msg_ref = (long)msg_var.inner;
6036 if (msg_var.is_owned) {
6039 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6041 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6042 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6043 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6046 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6047 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6049 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6050 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6051 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6052 LDKReplyShortChannelIdsEnd msg_var = msg;
6053 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6054 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6055 long msg_ref = (long)msg_var.inner;
6056 if (msg_var.is_owned) {
6059 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6061 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6062 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6063 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6066 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6067 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6069 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6070 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6071 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6072 LDKQueryChannelRange msg_var = msg;
6073 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6074 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6075 long msg_ref = (long)msg_var.inner;
6076 if (msg_var.is_owned) {
6079 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6081 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6082 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6083 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6086 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6087 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6089 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6090 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6091 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6092 LDKQueryShortChannelIds msg_var = msg;
6093 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6094 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6095 long msg_ref = (long)msg_var.inner;
6096 if (msg_var.is_owned) {
6099 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6101 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6102 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6103 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6106 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
6107 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6108 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6109 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6110 return (void*) this_arg;
6112 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6113 jclass c = (*env)->GetObjectClass(env, o);
6115 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6116 atomic_init(&calls->refcnt, 1);
6117 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6118 calls->o = (*env)->NewWeakGlobalRef(env, o);
6119 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
6120 CHECK(calls->handle_node_announcement_meth != NULL);
6121 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
6122 CHECK(calls->handle_channel_announcement_meth != NULL);
6123 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
6124 CHECK(calls->handle_channel_update_meth != NULL);
6125 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
6126 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
6127 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
6128 CHECK(calls->get_next_channel_announcements_meth != NULL);
6129 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
6130 CHECK(calls->get_next_node_announcements_meth != NULL);
6131 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
6132 CHECK(calls->sync_routing_table_meth != NULL);
6133 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
6134 CHECK(calls->handle_reply_channel_range_meth != NULL);
6135 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
6136 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
6137 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
6138 CHECK(calls->handle_query_channel_range_meth != NULL);
6139 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
6140 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
6142 LDKRoutingMessageHandler ret = {
6143 .this_arg = (void*) calls,
6144 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6145 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6146 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6147 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
6148 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6149 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6150 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6151 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6152 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6153 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6154 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6155 .free = LDKRoutingMessageHandler_JCalls_free,
6156 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
6158 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6162 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6163 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
6164 return (long)res_ptr;
6166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6167 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6168 LDKNodeAnnouncement msg_conv;
6169 msg_conv.inner = (void*)(msg & (~1));
6170 msg_conv.is_owned = false;
6171 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6172 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6173 return (long)ret_conv;
6176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6177 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6178 LDKChannelAnnouncement msg_conv;
6179 msg_conv.inner = (void*)(msg & (~1));
6180 msg_conv.is_owned = false;
6181 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6182 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6183 return (long)ret_conv;
6186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6187 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6188 LDKChannelUpdate msg_conv;
6189 msg_conv.inner = (void*)(msg & (~1));
6190 msg_conv.is_owned = false;
6191 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6192 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6193 return (long)ret_conv;
6196 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) {
6197 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6198 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6199 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6202 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) {
6203 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6204 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6205 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6206 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6207 for (size_t l = 0; l < ret_var.datalen; l++) {
6208 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6209 *ret_conv_63_ref = ret_var.data[l];
6210 ret_arr_ptr[l] = (long)ret_conv_63_ref;
6212 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6217 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) {
6218 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6219 LDKPublicKey starting_point_ref;
6220 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
6221 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
6222 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6223 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6224 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6225 for (size_t s = 0; s < ret_var.datalen; s++) {
6226 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6227 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6228 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6229 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
6230 if (ret_conv_18_var.is_owned) {
6231 ret_conv_18_ref |= 1;
6233 ret_arr_ptr[s] = ret_conv_18_ref;
6235 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6240 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) {
6241 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6242 LDKPublicKey their_node_id_ref;
6243 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6244 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6246 init_conv.inner = (void*)(init & (~1));
6247 init_conv.is_owned = false;
6248 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6251 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) {
6252 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6253 LDKPublicKey their_node_id_ref;
6254 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6255 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6256 LDKReplyChannelRange msg_conv;
6257 msg_conv.inner = (void*)(msg & (~1));
6258 msg_conv.is_owned = (msg & 1) || (msg == 0);
6259 msg_conv = ReplyChannelRange_clone(&msg_conv);
6260 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6261 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6262 return (long)ret_conv;
6265 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) {
6266 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6267 LDKPublicKey their_node_id_ref;
6268 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6269 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6270 LDKReplyShortChannelIdsEnd msg_conv;
6271 msg_conv.inner = (void*)(msg & (~1));
6272 msg_conv.is_owned = (msg & 1) || (msg == 0);
6273 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6274 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6275 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6276 return (long)ret_conv;
6279 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) {
6280 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6281 LDKPublicKey their_node_id_ref;
6282 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6283 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6284 LDKQueryChannelRange msg_conv;
6285 msg_conv.inner = (void*)(msg & (~1));
6286 msg_conv.is_owned = (msg & 1) || (msg == 0);
6287 msg_conv = QueryChannelRange_clone(&msg_conv);
6288 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6289 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6290 return (long)ret_conv;
6293 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) {
6294 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6295 LDKPublicKey their_node_id_ref;
6296 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6297 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6298 LDKQueryShortChannelIds msg_conv;
6299 msg_conv.inner = (void*)(msg & (~1));
6300 msg_conv.is_owned = (msg & 1) || (msg == 0);
6301 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6302 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6303 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6304 return (long)ret_conv;
6307 typedef struct LDKSocketDescriptor_JCalls {
6308 atomic_size_t refcnt;
6311 jmethodID send_data_meth;
6312 jmethodID disconnect_socket_meth;
6314 jmethodID hash_meth;
6315 } LDKSocketDescriptor_JCalls;
6316 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6317 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6318 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6320 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6321 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6325 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6326 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6328 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6329 LDKu8slice data_var = data;
6330 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
6331 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
6332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6334 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
6336 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6337 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6339 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6340 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6342 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
6344 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6345 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6347 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6348 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6349 *other_arg_clone = SocketDescriptor_clone(other_arg);
6350 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6352 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
6354 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6355 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6358 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6360 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
6362 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
6363 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6364 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6365 return (void*) this_arg;
6367 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
6368 jclass c = (*env)->GetObjectClass(env, o);
6370 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6371 atomic_init(&calls->refcnt, 1);
6372 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6373 calls->o = (*env)->NewWeakGlobalRef(env, o);
6374 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
6375 CHECK(calls->send_data_meth != NULL);
6376 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
6377 CHECK(calls->disconnect_socket_meth != NULL);
6378 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
6379 CHECK(calls->eq_meth != NULL);
6380 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
6381 CHECK(calls->hash_meth != NULL);
6383 LDKSocketDescriptor ret = {
6384 .this_arg = (void*) calls,
6385 .send_data = send_data_LDKSocketDescriptor_jcall,
6386 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6387 .eq = eq_LDKSocketDescriptor_jcall,
6388 .hash = hash_LDKSocketDescriptor_jcall,
6389 .clone = LDKSocketDescriptor_JCalls_clone,
6390 .free = LDKSocketDescriptor_JCalls_free,
6394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
6395 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6396 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
6397 return (long)res_ptr;
6399 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) {
6400 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6401 LDKu8slice data_ref;
6402 data_ref.datalen = (*env)->GetArrayLength(env, data);
6403 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
6404 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6405 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
6409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
6410 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6411 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
6415 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6416 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6421 LDKTransaction _res_ref;
6422 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6423 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6424 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6425 _res_ref.data_is_owned = true;
6426 Transaction_free(_res_ref);
6429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
6430 if ((_res & 1) != 0) return;
6431 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6433 TxOut_free(_res_conv);
6436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6437 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6438 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6439 *ret_ref = TxOut_clone(orig_conv);
6440 return (long)ret_ref;
6443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6445 CHECK((*env)->GetArrayLength(env, o) == 32);
6446 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6447 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6448 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6449 return (long)ret_conv;
6452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6453 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6454 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6455 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6456 return (long)ret_conv;
6459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6460 if ((_res & 1) != 0) return;
6461 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6463 CResult_SecretKeyErrorZ_free(_res_conv);
6466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6468 CHECK((*env)->GetArrayLength(env, o) == 33);
6469 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6470 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6471 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6472 return (long)ret_conv;
6475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6476 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6477 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6478 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6479 return (long)ret_conv;
6482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6483 if ((_res & 1) != 0) return;
6484 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6486 CResult_PublicKeyErrorZ_free(_res_conv);
6489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6490 LDKTxCreationKeys o_conv;
6491 o_conv.inner = (void*)(o & (~1));
6492 o_conv.is_owned = (o & 1) || (o == 0);
6493 o_conv = TxCreationKeys_clone(&o_conv);
6494 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6495 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6496 return (long)ret_conv;
6499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6500 LDKDecodeError e_conv;
6501 e_conv.inner = (void*)(e & (~1));
6502 e_conv.is_owned = (e & 1) || (e == 0);
6503 e_conv = DecodeError_clone(&e_conv);
6504 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6505 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6506 return (long)ret_conv;
6509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6510 if ((_res & 1) != 0) return;
6511 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6513 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6517 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6518 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6519 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6520 return (long)ret_conv;
6523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6524 LDKChannelPublicKeys o_conv;
6525 o_conv.inner = (void*)(o & (~1));
6526 o_conv.is_owned = (o & 1) || (o == 0);
6527 o_conv = ChannelPublicKeys_clone(&o_conv);
6528 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6529 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6530 return (long)ret_conv;
6533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6534 LDKDecodeError e_conv;
6535 e_conv.inner = (void*)(e & (~1));
6536 e_conv.is_owned = (e & 1) || (e == 0);
6537 e_conv = DecodeError_clone(&e_conv);
6538 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6539 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6540 return (long)ret_conv;
6543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6544 if ((_res & 1) != 0) return;
6545 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6547 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6551 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6552 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6553 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6554 return (long)ret_conv;
6557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6558 LDKTxCreationKeys o_conv;
6559 o_conv.inner = (void*)(o & (~1));
6560 o_conv.is_owned = (o & 1) || (o == 0);
6561 o_conv = TxCreationKeys_clone(&o_conv);
6562 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6563 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6564 return (long)ret_conv;
6567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6568 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6569 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6570 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6571 return (long)ret_conv;
6574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6575 if ((_res & 1) != 0) return;
6576 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6578 CResult_TxCreationKeysErrorZ_free(_res_conv);
6581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6582 LDKHTLCOutputInCommitment o_conv;
6583 o_conv.inner = (void*)(o & (~1));
6584 o_conv.is_owned = (o & 1) || (o == 0);
6585 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6586 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6587 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6588 return (long)ret_conv;
6591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6592 LDKDecodeError e_conv;
6593 e_conv.inner = (void*)(e & (~1));
6594 e_conv.is_owned = (e & 1) || (e == 0);
6595 e_conv = DecodeError_clone(&e_conv);
6596 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6597 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6598 return (long)ret_conv;
6601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6602 if ((_res & 1) != 0) return;
6603 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6605 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6609 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6610 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6611 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6612 return (long)ret_conv;
6615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6616 LDKCounterpartyChannelTransactionParameters o_conv;
6617 o_conv.inner = (void*)(o & (~1));
6618 o_conv.is_owned = (o & 1) || (o == 0);
6619 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6620 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6621 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6622 return (long)ret_conv;
6625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6626 LDKDecodeError e_conv;
6627 e_conv.inner = (void*)(e & (~1));
6628 e_conv.is_owned = (e & 1) || (e == 0);
6629 e_conv = DecodeError_clone(&e_conv);
6630 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6631 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6632 return (long)ret_conv;
6635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6636 if ((_res & 1) != 0) return;
6637 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6639 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6643 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6644 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6645 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6646 return (long)ret_conv;
6649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6650 LDKChannelTransactionParameters o_conv;
6651 o_conv.inner = (void*)(o & (~1));
6652 o_conv.is_owned = (o & 1) || (o == 0);
6653 o_conv = ChannelTransactionParameters_clone(&o_conv);
6654 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6655 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6656 return (long)ret_conv;
6659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6660 LDKDecodeError e_conv;
6661 e_conv.inner = (void*)(e & (~1));
6662 e_conv.is_owned = (e & 1) || (e == 0);
6663 e_conv = DecodeError_clone(&e_conv);
6664 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6665 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6666 return (long)ret_conv;
6669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6670 if ((_res & 1) != 0) return;
6671 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6673 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6677 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6678 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6679 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6680 return (long)ret_conv;
6683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6684 LDKCVec_SignatureZ _res_constr;
6685 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6686 if (_res_constr.datalen > 0)
6687 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6689 _res_constr.data = NULL;
6690 for (size_t i = 0; i < _res_constr.datalen; i++) {
6691 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6692 LDKSignature _res_conv_8_ref;
6693 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
6694 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
6695 _res_constr.data[i] = _res_conv_8_ref;
6697 CVec_SignatureZ_free(_res_constr);
6700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6701 LDKHolderCommitmentTransaction o_conv;
6702 o_conv.inner = (void*)(o & (~1));
6703 o_conv.is_owned = (o & 1) || (o == 0);
6704 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6705 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6706 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6707 return (long)ret_conv;
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6711 LDKDecodeError e_conv;
6712 e_conv.inner = (void*)(e & (~1));
6713 e_conv.is_owned = (e & 1) || (e == 0);
6714 e_conv = DecodeError_clone(&e_conv);
6715 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6716 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6717 return (long)ret_conv;
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6721 if ((_res & 1) != 0) return;
6722 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6724 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6728 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6729 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6730 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6731 return (long)ret_conv;
6734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6735 LDKBuiltCommitmentTransaction o_conv;
6736 o_conv.inner = (void*)(o & (~1));
6737 o_conv.is_owned = (o & 1) || (o == 0);
6738 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6739 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6740 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6741 return (long)ret_conv;
6744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6745 LDKDecodeError e_conv;
6746 e_conv.inner = (void*)(e & (~1));
6747 e_conv.is_owned = (e & 1) || (e == 0);
6748 e_conv = DecodeError_clone(&e_conv);
6749 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6750 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6751 return (long)ret_conv;
6754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6755 if ((_res & 1) != 0) return;
6756 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6758 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6762 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6763 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6764 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6765 return (long)ret_conv;
6768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6769 LDKCommitmentTransaction o_conv;
6770 o_conv.inner = (void*)(o & (~1));
6771 o_conv.is_owned = (o & 1) || (o == 0);
6772 o_conv = CommitmentTransaction_clone(&o_conv);
6773 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6774 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6775 return (long)ret_conv;
6778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6779 LDKDecodeError e_conv;
6780 e_conv.inner = (void*)(e & (~1));
6781 e_conv.is_owned = (e & 1) || (e == 0);
6782 e_conv = DecodeError_clone(&e_conv);
6783 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6784 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6785 return (long)ret_conv;
6788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6789 if ((_res & 1) != 0) return;
6790 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6792 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6796 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6797 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6798 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6799 return (long)ret_conv;
6802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6803 LDKTrustedCommitmentTransaction o_conv;
6804 o_conv.inner = (void*)(o & (~1));
6805 o_conv.is_owned = (o & 1) || (o == 0);
6806 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6807 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6808 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6809 return (long)ret_conv;
6812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6813 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6814 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6815 return (long)ret_conv;
6818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6819 if ((_res & 1) != 0) return;
6820 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6822 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6826 LDKCVec_SignatureZ o_constr;
6827 o_constr.datalen = (*env)->GetArrayLength(env, o);
6828 if (o_constr.datalen > 0)
6829 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6831 o_constr.data = NULL;
6832 for (size_t i = 0; i < o_constr.datalen; i++) {
6833 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6834 LDKSignature o_conv_8_ref;
6835 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
6836 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
6837 o_constr.data[i] = o_conv_8_ref;
6839 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6840 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6841 return (long)ret_conv;
6844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6845 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6846 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6847 return (long)ret_conv;
6850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6851 if ((_res & 1) != 0) return;
6852 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6854 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6858 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6859 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6860 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6861 return (long)ret_conv;
6864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6865 LDKCVec_MessageSendEventZ _res_constr;
6866 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6867 if (_res_constr.datalen > 0)
6868 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6870 _res_constr.data = NULL;
6871 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6872 for (size_t s = 0; s < _res_constr.datalen; s++) {
6873 int64_t _res_conv_18 = _res_vals[s];
6874 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6875 FREE((void*)_res_conv_18);
6876 _res_constr.data[s] = _res_conv_18_conv;
6878 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6879 CVec_MessageSendEventZ_free(_res_constr);
6882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6883 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6884 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6885 return (long)ret_conv;
6888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6889 LDKLightningError e_conv;
6890 e_conv.inner = (void*)(e & (~1));
6891 e_conv.is_owned = (e & 1) || (e == 0);
6892 e_conv = LightningError_clone(&e_conv);
6893 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6894 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6895 return (long)ret_conv;
6898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6899 if ((_res & 1) != 0) return;
6900 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6902 CResult_boolLightningErrorZ_free(_res_conv);
6905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6906 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6907 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6908 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6909 return (long)ret_conv;
6912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6913 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6914 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6915 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6916 return (long)ret_ref;
6919 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) {
6920 LDKChannelAnnouncement a_conv;
6921 a_conv.inner = (void*)(a & (~1));
6922 a_conv.is_owned = (a & 1) || (a == 0);
6923 a_conv = ChannelAnnouncement_clone(&a_conv);
6924 LDKChannelUpdate b_conv;
6925 b_conv.inner = (void*)(b & (~1));
6926 b_conv.is_owned = (b & 1) || (b == 0);
6927 b_conv = ChannelUpdate_clone(&b_conv);
6928 LDKChannelUpdate c_conv;
6929 c_conv.inner = (void*)(c & (~1));
6930 c_conv.is_owned = (c & 1) || (c == 0);
6931 c_conv = ChannelUpdate_clone(&c_conv);
6932 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6933 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6934 return (long)ret_ref;
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6938 if ((_res & 1) != 0) return;
6939 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6941 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6945 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6946 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6947 if (_res_constr.datalen > 0)
6948 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6950 _res_constr.data = NULL;
6951 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6952 for (size_t l = 0; l < _res_constr.datalen; l++) {
6953 int64_t _res_conv_63 = _res_vals[l];
6954 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6955 FREE((void*)_res_conv_63);
6956 _res_constr.data[l] = _res_conv_63_conv;
6958 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6959 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6963 LDKCVec_NodeAnnouncementZ _res_constr;
6964 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6965 if (_res_constr.datalen > 0)
6966 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6968 _res_constr.data = NULL;
6969 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6970 for (size_t s = 0; s < _res_constr.datalen; s++) {
6971 int64_t _res_conv_18 = _res_vals[s];
6972 LDKNodeAnnouncement _res_conv_18_conv;
6973 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6974 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6975 _res_constr.data[s] = _res_conv_18_conv;
6977 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6978 CVec_NodeAnnouncementZ_free(_res_constr);
6981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6982 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6983 *ret_conv = CResult_NoneLightningErrorZ_ok();
6984 return (long)ret_conv;
6987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6988 LDKLightningError e_conv;
6989 e_conv.inner = (void*)(e & (~1));
6990 e_conv.is_owned = (e & 1) || (e == 0);
6991 e_conv = LightningError_clone(&e_conv);
6992 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6993 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6994 return (long)ret_conv;
6997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6998 if ((_res & 1) != 0) return;
6999 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
7001 CResult_NoneLightningErrorZ_free(_res_conv);
7004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7005 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
7006 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7007 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
7008 return (long)ret_conv;
7011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7012 LDKCVec_PublicKeyZ _res_constr;
7013 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7014 if (_res_constr.datalen > 0)
7015 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7017 _res_constr.data = NULL;
7018 for (size_t i = 0; i < _res_constr.datalen; i++) {
7019 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7020 LDKPublicKey _res_conv_8_ref;
7021 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
7022 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
7023 _res_constr.data[i] = _res_conv_8_ref;
7025 CVec_PublicKeyZ_free(_res_constr);
7028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
7029 LDKCVec_u8Z _res_ref;
7030 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
7031 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
7032 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
7033 CVec_u8Z_free(_res_ref);
7036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
7038 o_ref.datalen = (*env)->GetArrayLength(env, o);
7039 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
7040 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
7041 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7042 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
7043 return (long)ret_conv;
7046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7047 LDKPeerHandleError e_conv;
7048 e_conv.inner = (void*)(e & (~1));
7049 e_conv.is_owned = (e & 1) || (e == 0);
7050 e_conv = PeerHandleError_clone(&e_conv);
7051 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7052 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
7053 return (long)ret_conv;
7056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7057 if ((_res & 1) != 0) return;
7058 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7060 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
7063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7064 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
7065 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7066 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
7067 return (long)ret_conv;
7070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
7071 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7072 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
7073 return (long)ret_conv;
7076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7077 LDKPeerHandleError e_conv;
7078 e_conv.inner = (void*)(e & (~1));
7079 e_conv.is_owned = (e & 1) || (e == 0);
7080 e_conv = PeerHandleError_clone(&e_conv);
7081 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7082 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
7083 return (long)ret_conv;
7086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7087 if ((_res & 1) != 0) return;
7088 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7090 CResult_NonePeerHandleErrorZ_free(_res_conv);
7093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7094 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
7095 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7096 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
7097 return (long)ret_conv;
7100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
7101 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7102 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
7103 return (long)ret_conv;
7106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7107 LDKPeerHandleError e_conv;
7108 e_conv.inner = (void*)(e & (~1));
7109 e_conv.is_owned = (e & 1) || (e == 0);
7110 e_conv = PeerHandleError_clone(&e_conv);
7111 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7112 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
7113 return (long)ret_conv;
7116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7117 if ((_res & 1) != 0) return;
7118 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7120 CResult_boolPeerHandleErrorZ_free(_res_conv);
7123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7124 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
7125 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7126 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
7127 return (long)ret_conv;
7130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7131 LDKInitFeatures o_conv;
7132 o_conv.inner = (void*)(o & (~1));
7133 o_conv.is_owned = (o & 1) || (o == 0);
7134 o_conv = InitFeatures_clone(&o_conv);
7135 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7136 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7137 return (long)ret_conv;
7140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7141 LDKDecodeError e_conv;
7142 e_conv.inner = (void*)(e & (~1));
7143 e_conv.is_owned = (e & 1) || (e == 0);
7144 e_conv = DecodeError_clone(&e_conv);
7145 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7146 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7147 return (long)ret_conv;
7150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7151 if ((_res & 1) != 0) return;
7152 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7154 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7158 LDKNodeFeatures o_conv;
7159 o_conv.inner = (void*)(o & (~1));
7160 o_conv.is_owned = (o & 1) || (o == 0);
7161 o_conv = NodeFeatures_clone(&o_conv);
7162 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7163 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7164 return (long)ret_conv;
7167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7168 LDKDecodeError e_conv;
7169 e_conv.inner = (void*)(e & (~1));
7170 e_conv.is_owned = (e & 1) || (e == 0);
7171 e_conv = DecodeError_clone(&e_conv);
7172 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7173 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7174 return (long)ret_conv;
7177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7178 if ((_res & 1) != 0) return;
7179 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7181 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7185 LDKChannelFeatures o_conv;
7186 o_conv.inner = (void*)(o & (~1));
7187 o_conv.is_owned = (o & 1) || (o == 0);
7188 o_conv = ChannelFeatures_clone(&o_conv);
7189 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7190 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7191 return (long)ret_conv;
7194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7195 LDKDecodeError e_conv;
7196 e_conv.inner = (void*)(e & (~1));
7197 e_conv.is_owned = (e & 1) || (e == 0);
7198 e_conv = DecodeError_clone(&e_conv);
7199 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7200 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7201 return (long)ret_conv;
7204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7205 if ((_res & 1) != 0) return;
7206 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7208 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7212 LDKInvoiceFeatures o_conv;
7213 o_conv.inner = (void*)(o & (~1));
7214 o_conv.is_owned = (o & 1) || (o == 0);
7215 o_conv = InvoiceFeatures_clone(&o_conv);
7216 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7217 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7218 return (long)ret_conv;
7221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7222 LDKDecodeError e_conv;
7223 e_conv.inner = (void*)(e & (~1));
7224 e_conv.is_owned = (e & 1) || (e == 0);
7225 e_conv = DecodeError_clone(&e_conv);
7226 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7227 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7228 return (long)ret_conv;
7231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7232 if ((_res & 1) != 0) return;
7233 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7235 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7239 LDKChannelConfig o_conv;
7240 o_conv.inner = (void*)(o & (~1));
7241 o_conv.is_owned = (o & 1) || (o == 0);
7242 o_conv = ChannelConfig_clone(&o_conv);
7243 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7244 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
7245 return (long)ret_conv;
7248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7249 LDKDecodeError e_conv;
7250 e_conv.inner = (void*)(e & (~1));
7251 e_conv.is_owned = (e & 1) || (e == 0);
7252 e_conv = DecodeError_clone(&e_conv);
7253 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7254 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
7255 return (long)ret_conv;
7258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7259 if ((_res & 1) != 0) return;
7260 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
7262 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
7265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7266 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
7267 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7268 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
7269 return (long)ret_conv;
7272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7273 LDKDirectionalChannelInfo o_conv;
7274 o_conv.inner = (void*)(o & (~1));
7275 o_conv.is_owned = (o & 1) || (o == 0);
7276 o_conv = DirectionalChannelInfo_clone(&o_conv);
7277 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7278 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7279 return (long)ret_conv;
7282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7283 LDKDecodeError e_conv;
7284 e_conv.inner = (void*)(e & (~1));
7285 e_conv.is_owned = (e & 1) || (e == 0);
7286 e_conv = DecodeError_clone(&e_conv);
7287 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7288 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7289 return (long)ret_conv;
7292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7293 if ((_res & 1) != 0) return;
7294 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7296 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7300 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7301 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7302 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7303 return (long)ret_conv;
7306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7307 LDKChannelInfo o_conv;
7308 o_conv.inner = (void*)(o & (~1));
7309 o_conv.is_owned = (o & 1) || (o == 0);
7310 o_conv = ChannelInfo_clone(&o_conv);
7311 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7312 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7313 return (long)ret_conv;
7316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7317 LDKDecodeError e_conv;
7318 e_conv.inner = (void*)(e & (~1));
7319 e_conv.is_owned = (e & 1) || (e == 0);
7320 e_conv = DecodeError_clone(&e_conv);
7321 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7322 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7323 return (long)ret_conv;
7326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7327 if ((_res & 1) != 0) return;
7328 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7330 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7334 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7335 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7336 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7337 return (long)ret_conv;
7340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7341 LDKRoutingFees o_conv;
7342 o_conv.inner = (void*)(o & (~1));
7343 o_conv.is_owned = (o & 1) || (o == 0);
7344 o_conv = RoutingFees_clone(&o_conv);
7345 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7346 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7347 return (long)ret_conv;
7350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7351 LDKDecodeError e_conv;
7352 e_conv.inner = (void*)(e & (~1));
7353 e_conv.is_owned = (e & 1) || (e == 0);
7354 e_conv = DecodeError_clone(&e_conv);
7355 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7356 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7357 return (long)ret_conv;
7360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7361 if ((_res & 1) != 0) return;
7362 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7364 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7368 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7369 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7370 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7371 return (long)ret_conv;
7374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7375 LDKCVec_NetAddressZ _res_constr;
7376 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7377 if (_res_constr.datalen > 0)
7378 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7380 _res_constr.data = NULL;
7381 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7382 for (size_t m = 0; m < _res_constr.datalen; m++) {
7383 int64_t _res_conv_12 = _res_vals[m];
7384 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7385 FREE((void*)_res_conv_12);
7386 _res_constr.data[m] = _res_conv_12_conv;
7388 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7389 CVec_NetAddressZ_free(_res_constr);
7392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7393 LDKNodeAnnouncementInfo o_conv;
7394 o_conv.inner = (void*)(o & (~1));
7395 o_conv.is_owned = (o & 1) || (o == 0);
7396 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7397 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7398 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7399 return (long)ret_conv;
7402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7403 LDKDecodeError e_conv;
7404 e_conv.inner = (void*)(e & (~1));
7405 e_conv.is_owned = (e & 1) || (e == 0);
7406 e_conv = DecodeError_clone(&e_conv);
7407 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7408 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7409 return (long)ret_conv;
7412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7413 if ((_res & 1) != 0) return;
7414 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7416 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7420 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7421 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7422 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7423 return (long)ret_conv;
7426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7427 LDKCVec_u64Z _res_constr;
7428 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7429 if (_res_constr.datalen > 0)
7430 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7432 _res_constr.data = NULL;
7433 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7434 for (size_t g = 0; g < _res_constr.datalen; g++) {
7435 int64_t _res_conv_6 = _res_vals[g];
7436 _res_constr.data[g] = _res_conv_6;
7438 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7439 CVec_u64Z_free(_res_constr);
7442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7444 o_conv.inner = (void*)(o & (~1));
7445 o_conv.is_owned = (o & 1) || (o == 0);
7446 o_conv = NodeInfo_clone(&o_conv);
7447 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7448 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7449 return (long)ret_conv;
7452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7453 LDKDecodeError e_conv;
7454 e_conv.inner = (void*)(e & (~1));
7455 e_conv.is_owned = (e & 1) || (e == 0);
7456 e_conv = DecodeError_clone(&e_conv);
7457 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7458 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7459 return (long)ret_conv;
7462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7463 if ((_res & 1) != 0) return;
7464 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7466 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7470 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7471 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7472 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7473 return (long)ret_conv;
7476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7477 LDKNetworkGraph o_conv;
7478 o_conv.inner = (void*)(o & (~1));
7479 o_conv.is_owned = (o & 1) || (o == 0);
7480 o_conv = NetworkGraph_clone(&o_conv);
7481 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7482 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7483 return (long)ret_conv;
7486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7487 LDKDecodeError e_conv;
7488 e_conv.inner = (void*)(e & (~1));
7489 e_conv.is_owned = (e & 1) || (e == 0);
7490 e_conv = DecodeError_clone(&e_conv);
7491 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7492 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7493 return (long)ret_conv;
7496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7497 if ((_res & 1) != 0) return;
7498 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7500 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7504 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7505 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7506 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7507 return (long)ret_conv;
7510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7511 LDKTransaction b_ref;
7512 b_ref.datalen = (*env)->GetArrayLength(env, b);
7513 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7514 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7515 b_ref.data_is_owned = true;
7516 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7517 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7518 return (long)ret_ref;
7521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7522 if ((_res & 1) != 0) return;
7523 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7525 C2Tuple_usizeTransactionZ_free(_res_conv);
7528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7529 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7530 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7531 if (_res_constr.datalen > 0)
7532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7534 _res_constr.data = NULL;
7535 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7536 for (size_t y = 0; y < _res_constr.datalen; y++) {
7537 int64_t _res_conv_24 = _res_vals[y];
7538 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
7539 FREE((void*)_res_conv_24);
7540 _res_constr.data[y] = _res_conv_24_conv;
7542 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7543 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
7547 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7548 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7549 return (long)ret_conv;
7552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
7553 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
7554 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7555 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7556 return (long)ret_conv;
7559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7560 if ((_res & 1) != 0) return;
7561 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7563 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7567 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7568 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7569 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7570 return (long)ret_conv;
7573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7574 LDKCVec_MonitorEventZ _res_constr;
7575 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7576 if (_res_constr.datalen > 0)
7577 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7579 _res_constr.data = NULL;
7580 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7581 for (size_t o = 0; o < _res_constr.datalen; o++) {
7582 int64_t _res_conv_14 = _res_vals[o];
7583 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7584 FREE((void*)_res_conv_14);
7585 _res_constr.data[o] = _res_conv_14_conv;
7587 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7588 CVec_MonitorEventZ_free(_res_constr);
7591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7592 LDKCVec_EventZ _res_constr;
7593 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7594 if (_res_constr.datalen > 0)
7595 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
7597 _res_constr.data = NULL;
7598 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7599 for (size_t h = 0; h < _res_constr.datalen; h++) {
7600 int64_t _res_conv_7 = _res_vals[h];
7601 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
7602 FREE((void*)_res_conv_7);
7603 _res_constr.data[h] = _res_conv_7_conv;
7605 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7606 CVec_EventZ_free(_res_constr);
7609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7611 o_conv.inner = (void*)(o & (~1));
7612 o_conv.is_owned = (o & 1) || (o == 0);
7613 o_conv = OutPoint_clone(&o_conv);
7614 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7615 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
7616 return (long)ret_conv;
7619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7620 LDKDecodeError e_conv;
7621 e_conv.inner = (void*)(e & (~1));
7622 e_conv.is_owned = (e & 1) || (e == 0);
7623 e_conv = DecodeError_clone(&e_conv);
7624 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7625 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
7626 return (long)ret_conv;
7629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7630 if ((_res & 1) != 0) return;
7631 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
7633 CResult_OutPointDecodeErrorZ_free(_res_conv);
7636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7637 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
7638 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7639 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
7640 return (long)ret_conv;
7643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7644 LDKChannelMonitorUpdate o_conv;
7645 o_conv.inner = (void*)(o & (~1));
7646 o_conv.is_owned = (o & 1) || (o == 0);
7647 o_conv = ChannelMonitorUpdate_clone(&o_conv);
7648 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7649 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
7650 return (long)ret_conv;
7653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7654 LDKDecodeError e_conv;
7655 e_conv.inner = (void*)(e & (~1));
7656 e_conv.is_owned = (e & 1) || (e == 0);
7657 e_conv = DecodeError_clone(&e_conv);
7658 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7659 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
7660 return (long)ret_conv;
7663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7664 if ((_res & 1) != 0) return;
7665 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7667 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
7670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7671 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
7672 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7673 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
7674 return (long)ret_conv;
7677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7678 LDKHTLCUpdate o_conv;
7679 o_conv.inner = (void*)(o & (~1));
7680 o_conv.is_owned = (o & 1) || (o == 0);
7681 o_conv = HTLCUpdate_clone(&o_conv);
7682 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7683 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
7684 return (long)ret_conv;
7687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7688 LDKDecodeError e_conv;
7689 e_conv.inner = (void*)(e & (~1));
7690 e_conv.is_owned = (e & 1) || (e == 0);
7691 e_conv = DecodeError_clone(&e_conv);
7692 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7693 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
7694 return (long)ret_conv;
7697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7698 if ((_res & 1) != 0) return;
7699 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7701 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
7704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7705 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
7706 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7707 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
7708 return (long)ret_conv;
7711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
7712 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7713 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
7714 return (long)ret_conv;
7717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7718 LDKMonitorUpdateError e_conv;
7719 e_conv.inner = (void*)(e & (~1));
7720 e_conv.is_owned = (e & 1) || (e == 0);
7721 e_conv = MonitorUpdateError_clone(&e_conv);
7722 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7723 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
7724 return (long)ret_conv;
7727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7728 if ((_res & 1) != 0) return;
7729 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
7731 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
7734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7735 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
7736 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7737 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
7738 return (long)ret_conv;
7741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7742 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
7743 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7744 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
7745 return (long)ret_ref;
7748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7750 a_conv.inner = (void*)(a & (~1));
7751 a_conv.is_owned = (a & 1) || (a == 0);
7752 a_conv = OutPoint_clone(&a_conv);
7754 b_ref.datalen = (*env)->GetArrayLength(env, b);
7755 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7756 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7757 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7758 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
7759 return (long)ret_ref;
7762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7763 if ((_res & 1) != 0) return;
7764 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
7766 C2Tuple_OutPointScriptZ_free(_res_conv);
7769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7770 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
7771 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7772 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
7773 return (long)ret_ref;
7776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
7778 b_ref.datalen = (*env)->GetArrayLength(env, b);
7779 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7780 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7781 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7782 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
7783 return (long)ret_ref;
7786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7787 if ((_res & 1) != 0) return;
7788 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
7790 C2Tuple_u32ScriptZ_free(_res_conv);
7793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7794 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
7795 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7796 if (_res_constr.datalen > 0)
7797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
7799 _res_constr.data = NULL;
7800 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7801 for (size_t b = 0; b < _res_constr.datalen; b++) {
7802 int64_t _res_conv_27 = _res_vals[b];
7803 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
7804 FREE((void*)_res_conv_27);
7805 _res_constr.data[b] = _res_conv_27_conv;
7807 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7808 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
7811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7812 LDKThirtyTwoBytes a_ref;
7813 CHECK((*env)->GetArrayLength(env, a) == 32);
7814 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7815 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
7816 b_constr.datalen = (*env)->GetArrayLength(env, b);
7817 if (b_constr.datalen > 0)
7818 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
7820 b_constr.data = NULL;
7821 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7822 for (size_t b = 0; b < b_constr.datalen; b++) {
7823 int64_t b_conv_27 = b_vals[b];
7824 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
7825 FREE((void*)b_conv_27);
7826 b_constr.data[b] = b_conv_27_conv;
7828 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7829 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
7830 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
7831 return (long)ret_ref;
7834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7835 if ((_res & 1) != 0) return;
7836 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
7838 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
7841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7842 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
7843 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7844 if (_res_constr.datalen > 0)
7845 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
7847 _res_constr.data = NULL;
7848 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7849 for (size_t v = 0; v < _res_constr.datalen; v++) {
7850 int64_t _res_conv_47 = _res_vals[v];
7851 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
7852 FREE((void*)_res_conv_47);
7853 _res_constr.data[v] = _res_conv_47_conv;
7855 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7856 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
7859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7860 LDKCVec_TransactionZ _res_constr;
7861 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7862 if (_res_constr.datalen > 0)
7863 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7865 _res_constr.data = NULL;
7866 for (size_t i = 0; i < _res_constr.datalen; i++) {
7867 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7868 LDKTransaction _res_conv_8_ref;
7869 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
7870 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
7871 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
7872 _res_conv_8_ref.data_is_owned = true;
7873 _res_constr.data[i] = _res_conv_8_ref;
7875 CVec_TransactionZ_free(_res_constr);
7878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7879 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
7880 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7881 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
7882 return (long)ret_ref;
7885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
7886 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
7888 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7889 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
7890 return (long)ret_ref;
7893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7894 if ((_res & 1) != 0) return;
7895 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
7897 C2Tuple_u32TxOutZ_free(_res_conv);
7900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7901 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
7902 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7903 if (_res_constr.datalen > 0)
7904 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7906 _res_constr.data = NULL;
7907 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7908 for (size_t a = 0; a < _res_constr.datalen; a++) {
7909 int64_t _res_conv_26 = _res_vals[a];
7910 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
7911 FREE((void*)_res_conv_26);
7912 _res_constr.data[a] = _res_conv_26_conv;
7914 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7915 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
7918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7919 LDKThirtyTwoBytes a_ref;
7920 CHECK((*env)->GetArrayLength(env, a) == 32);
7921 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7922 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
7923 b_constr.datalen = (*env)->GetArrayLength(env, b);
7924 if (b_constr.datalen > 0)
7925 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7927 b_constr.data = NULL;
7928 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7929 for (size_t a = 0; a < b_constr.datalen; a++) {
7930 int64_t b_conv_26 = b_vals[a];
7931 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
7932 FREE((void*)b_conv_26);
7933 b_constr.data[a] = b_conv_26_conv;
7935 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7936 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7937 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
7938 return (long)ret_ref;
7941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7942 if ((_res & 1) != 0) return;
7943 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
7945 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
7948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7949 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
7950 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7951 if (_res_constr.datalen > 0)
7952 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
7954 _res_constr.data = NULL;
7955 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7956 for (size_t u = 0; u < _res_constr.datalen; u++) {
7957 int64_t _res_conv_46 = _res_vals[u];
7958 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
7959 FREE((void*)_res_conv_46);
7960 _res_constr.data[u] = _res_conv_46_conv;
7962 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7963 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
7966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7967 LDKThirtyTwoBytes a_ref;
7968 CHECK((*env)->GetArrayLength(env, a) == 32);
7969 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7970 LDKChannelMonitor b_conv;
7971 b_conv.inner = (void*)(b & (~1));
7972 b_conv.is_owned = (b & 1) || (b == 0);
7973 b_conv = ChannelMonitor_clone(&b_conv);
7974 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7975 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7976 return (long)ret_ref;
7979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7980 if ((_res & 1) != 0) return;
7981 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7983 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7987 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
7989 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7990 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
7991 return (long)ret_conv;
7994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7995 LDKDecodeError e_conv;
7996 e_conv.inner = (void*)(e & (~1));
7997 e_conv.is_owned = (e & 1) || (e == 0);
7998 e_conv = DecodeError_clone(&e_conv);
7999 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8000 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
8001 return (long)ret_conv;
8004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8005 if ((_res & 1) != 0) return;
8006 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8008 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
8011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8012 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8013 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8014 if (_res_constr.datalen > 0)
8015 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8017 _res_constr.data = NULL;
8018 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8019 for (size_t b = 0; b < _res_constr.datalen; b++) {
8020 int64_t _res_conv_27 = _res_vals[b];
8021 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8022 FREE((void*)_res_conv_27);
8023 _res_constr.data[b] = _res_conv_27_conv;
8025 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8026 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8030 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
8032 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8033 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8034 return (long)ret_conv;
8037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8038 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
8039 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8040 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8041 return (long)ret_conv;
8044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8045 if ((_res & 1) != 0) return;
8046 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
8048 CResult_TxOutAccessErrorZ_free(_res_conv);
8051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8052 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8053 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8054 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8055 return (long)ret_conv;
8058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
8059 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8060 *ret_conv = CResult_NoneAPIErrorZ_ok();
8061 return (long)ret_conv;
8064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8065 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8067 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8068 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8069 return (long)ret_conv;
8072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8073 if ((_res & 1) != 0) return;
8074 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8076 CResult_NoneAPIErrorZ_free(_res_conv);
8079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8080 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8081 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8082 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8083 return (long)ret_conv;
8086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8087 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8088 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8089 if (_res_constr.datalen > 0)
8090 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8092 _res_constr.data = NULL;
8093 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8094 for (size_t w = 0; w < _res_constr.datalen; w++) {
8095 int64_t _res_conv_22 = _res_vals[w];
8096 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8097 FREE((void*)_res_conv_22);
8098 _res_constr.data[w] = _res_conv_22_conv;
8100 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8101 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8105 LDKCVec_APIErrorZ _res_constr;
8106 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8107 if (_res_constr.datalen > 0)
8108 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8110 _res_constr.data = NULL;
8111 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8112 for (size_t k = 0; k < _res_constr.datalen; k++) {
8113 int64_t _res_conv_10 = _res_vals[k];
8114 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8115 FREE((void*)_res_conv_10);
8116 _res_constr.data[k] = _res_conv_10_conv;
8118 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8119 CVec_APIErrorZ_free(_res_constr);
8122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8123 LDKCVec_ChannelDetailsZ _res_constr;
8124 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8125 if (_res_constr.datalen > 0)
8126 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8128 _res_constr.data = NULL;
8129 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8130 for (size_t q = 0; q < _res_constr.datalen; q++) {
8131 int64_t _res_conv_16 = _res_vals[q];
8132 LDKChannelDetails _res_conv_16_conv;
8133 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8134 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8135 _res_constr.data[q] = _res_conv_16_conv;
8137 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8138 CVec_ChannelDetailsZ_free(_res_constr);
8141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
8142 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8143 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8144 return (long)ret_conv;
8147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8148 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8150 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8151 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8152 return (long)ret_conv;
8155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8156 if ((_res & 1) != 0) return;
8157 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8159 CResult_NonePaymentSendFailureZ_free(_res_conv);
8162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8163 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8164 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8165 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8166 return (long)ret_conv;
8169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8170 LDKCVec_ChannelMonitorZ _res_constr;
8171 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8172 if (_res_constr.datalen > 0)
8173 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8175 _res_constr.data = NULL;
8176 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8177 for (size_t q = 0; q < _res_constr.datalen; q++) {
8178 int64_t _res_conv_16 = _res_vals[q];
8179 LDKChannelMonitor _res_conv_16_conv;
8180 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8181 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8182 _res_constr.data[q] = _res_conv_16_conv;
8184 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8185 CVec_ChannelMonitorZ_free(_res_constr);
8188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
8189 LDKThirtyTwoBytes a_ref;
8190 CHECK((*env)->GetArrayLength(env, a) == 32);
8191 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8192 LDKChannelManager b_conv;
8193 b_conv.inner = (void*)(b & (~1));
8194 b_conv.is_owned = (b & 1) || (b == 0);
8195 // Warning: we need a move here but no clone is available for LDKChannelManager
8196 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8197 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8198 return (long)ret_ref;
8201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8202 if ((_res & 1) != 0) return;
8203 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8205 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8209 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8211 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8212 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8213 return (long)ret_conv;
8216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8217 LDKDecodeError e_conv;
8218 e_conv.inner = (void*)(e & (~1));
8219 e_conv.is_owned = (e & 1) || (e == 0);
8220 e_conv = DecodeError_clone(&e_conv);
8221 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8222 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8223 return (long)ret_conv;
8226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8227 if ((_res & 1) != 0) return;
8228 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8230 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8234 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8236 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8237 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8238 return (long)ret_conv;
8241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8242 LDKDecodeError e_conv;
8243 e_conv.inner = (void*)(e & (~1));
8244 e_conv.is_owned = (e & 1) || (e == 0);
8245 e_conv = DecodeError_clone(&e_conv);
8246 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8247 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8248 return (long)ret_conv;
8251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8252 if ((_res & 1) != 0) return;
8253 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8255 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8259 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8260 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8261 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8262 return (long)ret_conv;
8265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8266 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8267 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8268 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8269 return (long)ret_ref;
8272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
8274 CHECK((*env)->GetArrayLength(env, a) == 64);
8275 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
8276 LDKCVec_SignatureZ b_constr;
8277 b_constr.datalen = (*env)->GetArrayLength(env, b);
8278 if (b_constr.datalen > 0)
8279 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8281 b_constr.data = NULL;
8282 for (size_t i = 0; i < b_constr.datalen; i++) {
8283 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
8284 LDKSignature b_conv_8_ref;
8285 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
8286 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
8287 b_constr.data[i] = b_conv_8_ref;
8289 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8290 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8291 return (long)ret_ref;
8294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8295 if ((_res & 1) != 0) return;
8296 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8298 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8302 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8305 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8306 return (long)ret_conv;
8309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
8310 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8311 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8312 return (long)ret_conv;
8315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8316 if ((_res & 1) != 0) return;
8317 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8319 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8323 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8324 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8325 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8326 return (long)ret_conv;
8329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8331 CHECK((*env)->GetArrayLength(env, o) == 64);
8332 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
8333 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8334 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8335 return (long)ret_conv;
8338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
8339 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8340 *ret_conv = CResult_SignatureNoneZ_err();
8341 return (long)ret_conv;
8344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8345 if ((_res & 1) != 0) return;
8346 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8348 CResult_SignatureNoneZ_free(_res_conv);
8351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8352 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8353 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8354 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8355 return (long)ret_conv;
8358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8359 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8360 if (o_conv.free == LDKSign_JCalls_free) {
8361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8362 LDKSign_JCalls_clone(o_conv.this_arg);
8364 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8365 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8366 return (long)ret_conv;
8369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8370 LDKDecodeError e_conv;
8371 e_conv.inner = (void*)(e & (~1));
8372 e_conv.is_owned = (e & 1) || (e == 0);
8373 e_conv = DecodeError_clone(&e_conv);
8374 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8375 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8376 return (long)ret_conv;
8379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8380 if ((_res & 1) != 0) return;
8381 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8383 CResult_SignDecodeErrorZ_free(_res_conv);
8386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8387 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8388 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8389 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8390 return (long)ret_conv;
8393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8394 LDKCVec_CVec_u8ZZ _res_constr;
8395 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8396 if (_res_constr.datalen > 0)
8397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8399 _res_constr.data = NULL;
8400 for (size_t i = 0; i < _res_constr.datalen; i++) {
8401 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8402 LDKCVec_u8Z _res_conv_8_ref;
8403 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
8404 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8405 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
8406 _res_constr.data[i] = _res_conv_8_ref;
8408 CVec_CVec_u8ZZ_free(_res_constr);
8411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
8412 LDKCVec_CVec_u8ZZ o_constr;
8413 o_constr.datalen = (*env)->GetArrayLength(env, o);
8414 if (o_constr.datalen > 0)
8415 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8417 o_constr.data = NULL;
8418 for (size_t i = 0; i < o_constr.datalen; i++) {
8419 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
8420 LDKCVec_u8Z o_conv_8_ref;
8421 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
8422 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8423 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
8424 o_constr.data[i] = o_conv_8_ref;
8426 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8427 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8428 return (long)ret_conv;
8431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
8432 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8433 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8434 return (long)ret_conv;
8437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8438 if ((_res & 1) != 0) return;
8439 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8441 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8445 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8446 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8447 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8448 return (long)ret_conv;
8451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8452 LDKInMemorySigner o_conv;
8453 o_conv.inner = (void*)(o & (~1));
8454 o_conv.is_owned = (o & 1) || (o == 0);
8455 o_conv = InMemorySigner_clone(&o_conv);
8456 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8457 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8458 return (long)ret_conv;
8461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8462 LDKDecodeError e_conv;
8463 e_conv.inner = (void*)(e & (~1));
8464 e_conv.is_owned = (e & 1) || (e == 0);
8465 e_conv = DecodeError_clone(&e_conv);
8466 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8467 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8468 return (long)ret_conv;
8471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8472 if ((_res & 1) != 0) return;
8473 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8475 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8479 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8480 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8481 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8482 return (long)ret_conv;
8485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8486 LDKCVec_TxOutZ _res_constr;
8487 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8488 if (_res_constr.datalen > 0)
8489 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8491 _res_constr.data = NULL;
8492 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8493 for (size_t h = 0; h < _res_constr.datalen; h++) {
8494 int64_t _res_conv_7 = _res_vals[h];
8495 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8496 FREE((void*)_res_conv_7);
8497 _res_constr.data[h] = _res_conv_7_conv;
8499 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8500 CVec_TxOutZ_free(_res_constr);
8503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8504 LDKTransaction o_ref;
8505 o_ref.datalen = (*env)->GetArrayLength(env, o);
8506 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8507 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
8508 o_ref.data_is_owned = true;
8509 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8510 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8511 return (long)ret_conv;
8514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
8515 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8516 *ret_conv = CResult_TransactionNoneZ_err();
8517 return (long)ret_conv;
8520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8521 if ((_res & 1) != 0) return;
8522 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8524 CResult_TransactionNoneZ_free(_res_conv);
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8528 LDKCVec_RouteHopZ _res_constr;
8529 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8530 if (_res_constr.datalen > 0)
8531 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8533 _res_constr.data = NULL;
8534 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8535 for (size_t k = 0; k < _res_constr.datalen; k++) {
8536 int64_t _res_conv_10 = _res_vals[k];
8537 LDKRouteHop _res_conv_10_conv;
8538 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8539 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8540 _res_constr.data[k] = _res_conv_10_conv;
8542 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8543 CVec_RouteHopZ_free(_res_constr);
8546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8547 LDKCVec_CVec_RouteHopZZ _res_constr;
8548 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8549 if (_res_constr.datalen > 0)
8550 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8552 _res_constr.data = NULL;
8553 for (size_t m = 0; m < _res_constr.datalen; m++) {
8554 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
8555 LDKCVec_RouteHopZ _res_conv_12_constr;
8556 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
8557 if (_res_conv_12_constr.datalen > 0)
8558 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8560 _res_conv_12_constr.data = NULL;
8561 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
8562 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8563 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8564 LDKRouteHop _res_conv_12_conv_10_conv;
8565 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8566 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8567 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8569 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
8570 _res_constr.data[m] = _res_conv_12_constr;
8572 CVec_CVec_RouteHopZZ_free(_res_constr);
8575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8577 o_conv.inner = (void*)(o & (~1));
8578 o_conv.is_owned = (o & 1) || (o == 0);
8579 o_conv = Route_clone(&o_conv);
8580 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8581 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8582 return (long)ret_conv;
8585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8586 LDKDecodeError e_conv;
8587 e_conv.inner = (void*)(e & (~1));
8588 e_conv.is_owned = (e & 1) || (e == 0);
8589 e_conv = DecodeError_clone(&e_conv);
8590 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8591 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8592 return (long)ret_conv;
8595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8596 if ((_res & 1) != 0) return;
8597 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
8599 CResult_RouteDecodeErrorZ_free(_res_conv);
8602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8603 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8604 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8605 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8606 return (long)ret_conv;
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8610 LDKCVec_RouteHintZ _res_constr;
8611 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8612 if (_res_constr.datalen > 0)
8613 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8615 _res_constr.data = NULL;
8616 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8617 for (size_t l = 0; l < _res_constr.datalen; l++) {
8618 int64_t _res_conv_11 = _res_vals[l];
8619 LDKRouteHint _res_conv_11_conv;
8620 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8621 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8622 _res_constr.data[l] = _res_conv_11_conv;
8624 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8625 CVec_RouteHintZ_free(_res_constr);
8628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8630 o_conv.inner = (void*)(o & (~1));
8631 o_conv.is_owned = (o & 1) || (o == 0);
8632 o_conv = Route_clone(&o_conv);
8633 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8634 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8635 return (long)ret_conv;
8638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8639 LDKLightningError e_conv;
8640 e_conv.inner = (void*)(e & (~1));
8641 e_conv.is_owned = (e & 1) || (e == 0);
8642 e_conv = LightningError_clone(&e_conv);
8643 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8644 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8645 return (long)ret_conv;
8648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8649 if ((_res & 1) != 0) return;
8650 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8652 CResult_RouteLightningErrorZ_free(_res_conv);
8655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8656 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8657 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8658 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8659 return (long)ret_conv;
8662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
8663 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
8665 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8666 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
8667 return (long)ret_conv;
8670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
8671 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8672 *ret_conv = CResult_NetAddressu8Z_err(e);
8673 return (long)ret_conv;
8676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8677 if ((_res & 1) != 0) return;
8678 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
8680 CResult_NetAddressu8Z_free(_res_conv);
8683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8684 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
8685 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8686 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
8687 return (long)ret_conv;
8690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8691 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
8693 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8694 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
8695 return (long)ret_conv;
8698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8699 LDKDecodeError e_conv;
8700 e_conv.inner = (void*)(e & (~1));
8701 e_conv.is_owned = (e & 1) || (e == 0);
8702 e_conv = DecodeError_clone(&e_conv);
8703 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8704 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
8705 return (long)ret_conv;
8708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8709 if ((_res & 1) != 0) return;
8710 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8712 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
8715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8716 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
8717 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8718 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
8719 return (long)ret_conv;
8722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8723 LDKCVec_UpdateAddHTLCZ _res_constr;
8724 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8725 if (_res_constr.datalen > 0)
8726 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
8728 _res_constr.data = NULL;
8729 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8730 for (size_t p = 0; p < _res_constr.datalen; p++) {
8731 int64_t _res_conv_15 = _res_vals[p];
8732 LDKUpdateAddHTLC _res_conv_15_conv;
8733 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
8734 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
8735 _res_constr.data[p] = _res_conv_15_conv;
8737 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8738 CVec_UpdateAddHTLCZ_free(_res_constr);
8741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8742 LDKCVec_UpdateFulfillHTLCZ _res_constr;
8743 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8744 if (_res_constr.datalen > 0)
8745 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
8747 _res_constr.data = NULL;
8748 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8749 for (size_t t = 0; t < _res_constr.datalen; t++) {
8750 int64_t _res_conv_19 = _res_vals[t];
8751 LDKUpdateFulfillHTLC _res_conv_19_conv;
8752 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
8753 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
8754 _res_constr.data[t] = _res_conv_19_conv;
8756 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8757 CVec_UpdateFulfillHTLCZ_free(_res_constr);
8760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8761 LDKCVec_UpdateFailHTLCZ _res_constr;
8762 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8763 if (_res_constr.datalen > 0)
8764 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
8766 _res_constr.data = NULL;
8767 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8768 for (size_t q = 0; q < _res_constr.datalen; q++) {
8769 int64_t _res_conv_16 = _res_vals[q];
8770 LDKUpdateFailHTLC _res_conv_16_conv;
8771 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8772 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8773 _res_constr.data[q] = _res_conv_16_conv;
8775 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8776 CVec_UpdateFailHTLCZ_free(_res_constr);
8779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8780 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
8781 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8782 if (_res_constr.datalen > 0)
8783 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
8785 _res_constr.data = NULL;
8786 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8787 for (size_t z = 0; z < _res_constr.datalen; z++) {
8788 int64_t _res_conv_25 = _res_vals[z];
8789 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
8790 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
8791 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
8792 _res_constr.data[z] = _res_conv_25_conv;
8794 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8795 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
8798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8799 LDKAcceptChannel o_conv;
8800 o_conv.inner = (void*)(o & (~1));
8801 o_conv.is_owned = (o & 1) || (o == 0);
8802 o_conv = AcceptChannel_clone(&o_conv);
8803 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8804 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
8805 return (long)ret_conv;
8808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8809 LDKDecodeError e_conv;
8810 e_conv.inner = (void*)(e & (~1));
8811 e_conv.is_owned = (e & 1) || (e == 0);
8812 e_conv = DecodeError_clone(&e_conv);
8813 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8814 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
8815 return (long)ret_conv;
8818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8819 if ((_res & 1) != 0) return;
8820 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8822 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
8825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8826 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
8827 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8828 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
8829 return (long)ret_conv;
8832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8833 LDKAnnouncementSignatures o_conv;
8834 o_conv.inner = (void*)(o & (~1));
8835 o_conv.is_owned = (o & 1) || (o == 0);
8836 o_conv = AnnouncementSignatures_clone(&o_conv);
8837 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8838 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
8839 return (long)ret_conv;
8842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8843 LDKDecodeError e_conv;
8844 e_conv.inner = (void*)(e & (~1));
8845 e_conv.is_owned = (e & 1) || (e == 0);
8846 e_conv = DecodeError_clone(&e_conv);
8847 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8848 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
8849 return (long)ret_conv;
8852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8853 if ((_res & 1) != 0) return;
8854 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8856 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
8859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8860 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
8861 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8862 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
8863 return (long)ret_conv;
8866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8867 LDKChannelReestablish o_conv;
8868 o_conv.inner = (void*)(o & (~1));
8869 o_conv.is_owned = (o & 1) || (o == 0);
8870 o_conv = ChannelReestablish_clone(&o_conv);
8871 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8872 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
8873 return (long)ret_conv;
8876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8877 LDKDecodeError e_conv;
8878 e_conv.inner = (void*)(e & (~1));
8879 e_conv.is_owned = (e & 1) || (e == 0);
8880 e_conv = DecodeError_clone(&e_conv);
8881 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8882 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
8883 return (long)ret_conv;
8886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8887 if ((_res & 1) != 0) return;
8888 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
8890 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
8893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8894 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
8895 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8896 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
8897 return (long)ret_conv;
8900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8901 LDKClosingSigned o_conv;
8902 o_conv.inner = (void*)(o & (~1));
8903 o_conv.is_owned = (o & 1) || (o == 0);
8904 o_conv = ClosingSigned_clone(&o_conv);
8905 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8906 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
8907 return (long)ret_conv;
8910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8911 LDKDecodeError e_conv;
8912 e_conv.inner = (void*)(e & (~1));
8913 e_conv.is_owned = (e & 1) || (e == 0);
8914 e_conv = DecodeError_clone(&e_conv);
8915 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8916 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
8917 return (long)ret_conv;
8920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8921 if ((_res & 1) != 0) return;
8922 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8924 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
8927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8928 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
8929 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8930 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
8931 return (long)ret_conv;
8934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8935 LDKCommitmentSigned o_conv;
8936 o_conv.inner = (void*)(o & (~1));
8937 o_conv.is_owned = (o & 1) || (o == 0);
8938 o_conv = CommitmentSigned_clone(&o_conv);
8939 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8940 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
8941 return (long)ret_conv;
8944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8945 LDKDecodeError e_conv;
8946 e_conv.inner = (void*)(e & (~1));
8947 e_conv.is_owned = (e & 1) || (e == 0);
8948 e_conv = DecodeError_clone(&e_conv);
8949 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8950 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
8951 return (long)ret_conv;
8954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8955 if ((_res & 1) != 0) return;
8956 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8958 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
8961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8962 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
8963 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8964 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
8965 return (long)ret_conv;
8968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8969 LDKFundingCreated o_conv;
8970 o_conv.inner = (void*)(o & (~1));
8971 o_conv.is_owned = (o & 1) || (o == 0);
8972 o_conv = FundingCreated_clone(&o_conv);
8973 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8974 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
8975 return (long)ret_conv;
8978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8979 LDKDecodeError e_conv;
8980 e_conv.inner = (void*)(e & (~1));
8981 e_conv.is_owned = (e & 1) || (e == 0);
8982 e_conv = DecodeError_clone(&e_conv);
8983 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8984 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
8985 return (long)ret_conv;
8988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8989 if ((_res & 1) != 0) return;
8990 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8992 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
8995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8996 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
8997 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8998 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
8999 return (long)ret_conv;
9002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9003 LDKFundingSigned o_conv;
9004 o_conv.inner = (void*)(o & (~1));
9005 o_conv.is_owned = (o & 1) || (o == 0);
9006 o_conv = FundingSigned_clone(&o_conv);
9007 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9008 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
9009 return (long)ret_conv;
9012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9013 LDKDecodeError e_conv;
9014 e_conv.inner = (void*)(e & (~1));
9015 e_conv.is_owned = (e & 1) || (e == 0);
9016 e_conv = DecodeError_clone(&e_conv);
9017 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9018 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
9019 return (long)ret_conv;
9022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9023 if ((_res & 1) != 0) return;
9024 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9026 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
9029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9030 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
9031 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9032 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
9033 return (long)ret_conv;
9036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9037 LDKFundingLocked o_conv;
9038 o_conv.inner = (void*)(o & (~1));
9039 o_conv.is_owned = (o & 1) || (o == 0);
9040 o_conv = FundingLocked_clone(&o_conv);
9041 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9042 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
9043 return (long)ret_conv;
9046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9047 LDKDecodeError e_conv;
9048 e_conv.inner = (void*)(e & (~1));
9049 e_conv.is_owned = (e & 1) || (e == 0);
9050 e_conv = DecodeError_clone(&e_conv);
9051 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9052 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
9053 return (long)ret_conv;
9056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9057 if ((_res & 1) != 0) return;
9058 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9060 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
9063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9064 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
9065 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9066 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
9067 return (long)ret_conv;
9070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9072 o_conv.inner = (void*)(o & (~1));
9073 o_conv.is_owned = (o & 1) || (o == 0);
9074 o_conv = Init_clone(&o_conv);
9075 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9076 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
9077 return (long)ret_conv;
9080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9081 LDKDecodeError e_conv;
9082 e_conv.inner = (void*)(e & (~1));
9083 e_conv.is_owned = (e & 1) || (e == 0);
9084 e_conv = DecodeError_clone(&e_conv);
9085 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9086 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
9087 return (long)ret_conv;
9090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9091 if ((_res & 1) != 0) return;
9092 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
9094 CResult_InitDecodeErrorZ_free(_res_conv);
9097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9098 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
9099 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9100 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
9101 return (long)ret_conv;
9104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9105 LDKOpenChannel o_conv;
9106 o_conv.inner = (void*)(o & (~1));
9107 o_conv.is_owned = (o & 1) || (o == 0);
9108 o_conv = OpenChannel_clone(&o_conv);
9109 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9110 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
9111 return (long)ret_conv;
9114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9115 LDKDecodeError e_conv;
9116 e_conv.inner = (void*)(e & (~1));
9117 e_conv.is_owned = (e & 1) || (e == 0);
9118 e_conv = DecodeError_clone(&e_conv);
9119 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9120 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
9121 return (long)ret_conv;
9124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9125 if ((_res & 1) != 0) return;
9126 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9128 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
9131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9132 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
9133 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9134 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
9135 return (long)ret_conv;
9138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9139 LDKRevokeAndACK o_conv;
9140 o_conv.inner = (void*)(o & (~1));
9141 o_conv.is_owned = (o & 1) || (o == 0);
9142 o_conv = RevokeAndACK_clone(&o_conv);
9143 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9144 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
9145 return (long)ret_conv;
9148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9149 LDKDecodeError e_conv;
9150 e_conv.inner = (void*)(e & (~1));
9151 e_conv.is_owned = (e & 1) || (e == 0);
9152 e_conv = DecodeError_clone(&e_conv);
9153 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9154 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
9155 return (long)ret_conv;
9158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9159 if ((_res & 1) != 0) return;
9160 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
9162 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
9165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9166 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
9167 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9168 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
9169 return (long)ret_conv;
9172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9174 o_conv.inner = (void*)(o & (~1));
9175 o_conv.is_owned = (o & 1) || (o == 0);
9176 o_conv = Shutdown_clone(&o_conv);
9177 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9178 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
9179 return (long)ret_conv;
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9183 LDKDecodeError e_conv;
9184 e_conv.inner = (void*)(e & (~1));
9185 e_conv.is_owned = (e & 1) || (e == 0);
9186 e_conv = DecodeError_clone(&e_conv);
9187 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9188 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
9189 return (long)ret_conv;
9192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9193 if ((_res & 1) != 0) return;
9194 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
9196 CResult_ShutdownDecodeErrorZ_free(_res_conv);
9199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9200 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
9201 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9202 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
9203 return (long)ret_conv;
9206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9207 LDKUpdateFailHTLC o_conv;
9208 o_conv.inner = (void*)(o & (~1));
9209 o_conv.is_owned = (o & 1) || (o == 0);
9210 o_conv = UpdateFailHTLC_clone(&o_conv);
9211 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9212 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
9213 return (long)ret_conv;
9216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9217 LDKDecodeError e_conv;
9218 e_conv.inner = (void*)(e & (~1));
9219 e_conv.is_owned = (e & 1) || (e == 0);
9220 e_conv = DecodeError_clone(&e_conv);
9221 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9222 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
9223 return (long)ret_conv;
9226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9227 if ((_res & 1) != 0) return;
9228 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9230 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
9233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9234 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
9235 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9236 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
9237 return (long)ret_conv;
9240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9241 LDKUpdateFailMalformedHTLC o_conv;
9242 o_conv.inner = (void*)(o & (~1));
9243 o_conv.is_owned = (o & 1) || (o == 0);
9244 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
9245 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9246 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
9247 return (long)ret_conv;
9250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9251 LDKDecodeError e_conv;
9252 e_conv.inner = (void*)(e & (~1));
9253 e_conv.is_owned = (e & 1) || (e == 0);
9254 e_conv = DecodeError_clone(&e_conv);
9255 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9256 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
9257 return (long)ret_conv;
9260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9261 if ((_res & 1) != 0) return;
9262 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9264 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
9267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9268 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
9269 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9270 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
9271 return (long)ret_conv;
9274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9275 LDKUpdateFee o_conv;
9276 o_conv.inner = (void*)(o & (~1));
9277 o_conv.is_owned = (o & 1) || (o == 0);
9278 o_conv = UpdateFee_clone(&o_conv);
9279 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9280 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
9281 return (long)ret_conv;
9284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9285 LDKDecodeError e_conv;
9286 e_conv.inner = (void*)(e & (~1));
9287 e_conv.is_owned = (e & 1) || (e == 0);
9288 e_conv = DecodeError_clone(&e_conv);
9289 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9290 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
9291 return (long)ret_conv;
9294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9295 if ((_res & 1) != 0) return;
9296 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9298 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
9301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9302 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
9303 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9304 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
9305 return (long)ret_conv;
9308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9309 LDKUpdateFulfillHTLC o_conv;
9310 o_conv.inner = (void*)(o & (~1));
9311 o_conv.is_owned = (o & 1) || (o == 0);
9312 o_conv = UpdateFulfillHTLC_clone(&o_conv);
9313 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9314 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
9315 return (long)ret_conv;
9318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9319 LDKDecodeError e_conv;
9320 e_conv.inner = (void*)(e & (~1));
9321 e_conv.is_owned = (e & 1) || (e == 0);
9322 e_conv = DecodeError_clone(&e_conv);
9323 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9324 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
9325 return (long)ret_conv;
9328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9329 if ((_res & 1) != 0) return;
9330 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9332 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
9335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9336 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
9337 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9338 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
9339 return (long)ret_conv;
9342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9343 LDKUpdateAddHTLC o_conv;
9344 o_conv.inner = (void*)(o & (~1));
9345 o_conv.is_owned = (o & 1) || (o == 0);
9346 o_conv = UpdateAddHTLC_clone(&o_conv);
9347 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9348 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
9349 return (long)ret_conv;
9352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9353 LDKDecodeError e_conv;
9354 e_conv.inner = (void*)(e & (~1));
9355 e_conv.is_owned = (e & 1) || (e == 0);
9356 e_conv = DecodeError_clone(&e_conv);
9357 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9358 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
9359 return (long)ret_conv;
9362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9363 if ((_res & 1) != 0) return;
9364 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9366 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
9369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9370 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
9371 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9372 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
9373 return (long)ret_conv;
9376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9378 o_conv.inner = (void*)(o & (~1));
9379 o_conv.is_owned = (o & 1) || (o == 0);
9380 o_conv = Ping_clone(&o_conv);
9381 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9382 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
9383 return (long)ret_conv;
9386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9387 LDKDecodeError e_conv;
9388 e_conv.inner = (void*)(e & (~1));
9389 e_conv.is_owned = (e & 1) || (e == 0);
9390 e_conv = DecodeError_clone(&e_conv);
9391 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9392 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
9393 return (long)ret_conv;
9396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9397 if ((_res & 1) != 0) return;
9398 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
9400 CResult_PingDecodeErrorZ_free(_res_conv);
9403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9404 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
9405 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9406 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
9407 return (long)ret_conv;
9410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9412 o_conv.inner = (void*)(o & (~1));
9413 o_conv.is_owned = (o & 1) || (o == 0);
9414 o_conv = Pong_clone(&o_conv);
9415 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9416 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
9417 return (long)ret_conv;
9420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9421 LDKDecodeError e_conv;
9422 e_conv.inner = (void*)(e & (~1));
9423 e_conv.is_owned = (e & 1) || (e == 0);
9424 e_conv = DecodeError_clone(&e_conv);
9425 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9426 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
9427 return (long)ret_conv;
9430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9431 if ((_res & 1) != 0) return;
9432 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
9434 CResult_PongDecodeErrorZ_free(_res_conv);
9437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9438 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
9439 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9440 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
9441 return (long)ret_conv;
9444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9445 LDKUnsignedChannelAnnouncement o_conv;
9446 o_conv.inner = (void*)(o & (~1));
9447 o_conv.is_owned = (o & 1) || (o == 0);
9448 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
9449 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9450 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
9451 return (long)ret_conv;
9454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9455 LDKDecodeError e_conv;
9456 e_conv.inner = (void*)(e & (~1));
9457 e_conv.is_owned = (e & 1) || (e == 0);
9458 e_conv = DecodeError_clone(&e_conv);
9459 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9460 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
9461 return (long)ret_conv;
9464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9465 if ((_res & 1) != 0) return;
9466 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9468 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9472 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9473 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9474 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9475 return (long)ret_conv;
9478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9479 LDKChannelAnnouncement o_conv;
9480 o_conv.inner = (void*)(o & (~1));
9481 o_conv.is_owned = (o & 1) || (o == 0);
9482 o_conv = ChannelAnnouncement_clone(&o_conv);
9483 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9484 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
9485 return (long)ret_conv;
9488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9489 LDKDecodeError e_conv;
9490 e_conv.inner = (void*)(e & (~1));
9491 e_conv.is_owned = (e & 1) || (e == 0);
9492 e_conv = DecodeError_clone(&e_conv);
9493 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9494 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
9495 return (long)ret_conv;
9498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9499 if ((_res & 1) != 0) return;
9500 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9502 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
9505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9506 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9507 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9508 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9509 return (long)ret_conv;
9512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9513 LDKUnsignedChannelUpdate o_conv;
9514 o_conv.inner = (void*)(o & (~1));
9515 o_conv.is_owned = (o & 1) || (o == 0);
9516 o_conv = UnsignedChannelUpdate_clone(&o_conv);
9517 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9518 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
9519 return (long)ret_conv;
9522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9523 LDKDecodeError e_conv;
9524 e_conv.inner = (void*)(e & (~1));
9525 e_conv.is_owned = (e & 1) || (e == 0);
9526 e_conv = DecodeError_clone(&e_conv);
9527 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9528 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
9529 return (long)ret_conv;
9532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9533 if ((_res & 1) != 0) return;
9534 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9536 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
9539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9540 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
9541 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9542 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
9543 return (long)ret_conv;
9546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9547 LDKChannelUpdate o_conv;
9548 o_conv.inner = (void*)(o & (~1));
9549 o_conv.is_owned = (o & 1) || (o == 0);
9550 o_conv = ChannelUpdate_clone(&o_conv);
9551 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9552 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
9553 return (long)ret_conv;
9556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9557 LDKDecodeError e_conv;
9558 e_conv.inner = (void*)(e & (~1));
9559 e_conv.is_owned = (e & 1) || (e == 0);
9560 e_conv = DecodeError_clone(&e_conv);
9561 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9562 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
9563 return (long)ret_conv;
9566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9567 if ((_res & 1) != 0) return;
9568 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9570 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
9573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9574 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
9575 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9576 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
9577 return (long)ret_conv;
9580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9581 LDKErrorMessage o_conv;
9582 o_conv.inner = (void*)(o & (~1));
9583 o_conv.is_owned = (o & 1) || (o == 0);
9584 o_conv = ErrorMessage_clone(&o_conv);
9585 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9586 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
9587 return (long)ret_conv;
9590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9591 LDKDecodeError e_conv;
9592 e_conv.inner = (void*)(e & (~1));
9593 e_conv.is_owned = (e & 1) || (e == 0);
9594 e_conv = DecodeError_clone(&e_conv);
9595 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9596 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
9597 return (long)ret_conv;
9600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9601 if ((_res & 1) != 0) return;
9602 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
9604 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9608 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
9609 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9610 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
9611 return (long)ret_conv;
9614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9615 LDKUnsignedNodeAnnouncement o_conv;
9616 o_conv.inner = (void*)(o & (~1));
9617 o_conv.is_owned = (o & 1) || (o == 0);
9618 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
9619 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9620 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
9621 return (long)ret_conv;
9624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9625 LDKDecodeError e_conv;
9626 e_conv.inner = (void*)(e & (~1));
9627 e_conv.is_owned = (e & 1) || (e == 0);
9628 e_conv = DecodeError_clone(&e_conv);
9629 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9630 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
9631 return (long)ret_conv;
9634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9635 if ((_res & 1) != 0) return;
9636 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9638 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
9641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9642 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
9643 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9644 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
9645 return (long)ret_conv;
9648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9649 LDKNodeAnnouncement o_conv;
9650 o_conv.inner = (void*)(o & (~1));
9651 o_conv.is_owned = (o & 1) || (o == 0);
9652 o_conv = NodeAnnouncement_clone(&o_conv);
9653 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9654 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
9655 return (long)ret_conv;
9658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9659 LDKDecodeError e_conv;
9660 e_conv.inner = (void*)(e & (~1));
9661 e_conv.is_owned = (e & 1) || (e == 0);
9662 e_conv = DecodeError_clone(&e_conv);
9663 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9664 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
9665 return (long)ret_conv;
9668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9669 if ((_res & 1) != 0) return;
9670 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9672 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
9675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9676 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
9677 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9678 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
9679 return (long)ret_conv;
9682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9683 LDKQueryShortChannelIds o_conv;
9684 o_conv.inner = (void*)(o & (~1));
9685 o_conv.is_owned = (o & 1) || (o == 0);
9686 o_conv = QueryShortChannelIds_clone(&o_conv);
9687 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9688 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
9689 return (long)ret_conv;
9692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9693 LDKDecodeError e_conv;
9694 e_conv.inner = (void*)(e & (~1));
9695 e_conv.is_owned = (e & 1) || (e == 0);
9696 e_conv = DecodeError_clone(&e_conv);
9697 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9698 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
9699 return (long)ret_conv;
9702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9703 if ((_res & 1) != 0) return;
9704 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
9706 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
9709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9710 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
9711 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9712 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
9713 return (long)ret_conv;
9716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9717 LDKReplyShortChannelIdsEnd o_conv;
9718 o_conv.inner = (void*)(o & (~1));
9719 o_conv.is_owned = (o & 1) || (o == 0);
9720 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
9721 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9722 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
9723 return (long)ret_conv;
9726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9727 LDKDecodeError e_conv;
9728 e_conv.inner = (void*)(e & (~1));
9729 e_conv.is_owned = (e & 1) || (e == 0);
9730 e_conv = DecodeError_clone(&e_conv);
9731 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9732 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
9733 return (long)ret_conv;
9736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9737 if ((_res & 1) != 0) return;
9738 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
9740 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
9743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9744 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
9745 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9746 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
9747 return (long)ret_conv;
9750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9751 LDKQueryChannelRange o_conv;
9752 o_conv.inner = (void*)(o & (~1));
9753 o_conv.is_owned = (o & 1) || (o == 0);
9754 o_conv = QueryChannelRange_clone(&o_conv);
9755 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9756 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
9757 return (long)ret_conv;
9760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9761 LDKDecodeError e_conv;
9762 e_conv.inner = (void*)(e & (~1));
9763 e_conv.is_owned = (e & 1) || (e == 0);
9764 e_conv = DecodeError_clone(&e_conv);
9765 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9766 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
9767 return (long)ret_conv;
9770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9771 if ((_res & 1) != 0) return;
9772 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9774 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
9777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9778 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
9779 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9780 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
9781 return (long)ret_conv;
9784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9785 LDKReplyChannelRange o_conv;
9786 o_conv.inner = (void*)(o & (~1));
9787 o_conv.is_owned = (o & 1) || (o == 0);
9788 o_conv = ReplyChannelRange_clone(&o_conv);
9789 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9790 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
9791 return (long)ret_conv;
9794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9795 LDKDecodeError e_conv;
9796 e_conv.inner = (void*)(e & (~1));
9797 e_conv.is_owned = (e & 1) || (e == 0);
9798 e_conv = DecodeError_clone(&e_conv);
9799 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9800 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
9801 return (long)ret_conv;
9804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9805 if ((_res & 1) != 0) return;
9806 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9808 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
9811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9812 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
9813 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9814 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
9815 return (long)ret_conv;
9818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9819 LDKGossipTimestampFilter o_conv;
9820 o_conv.inner = (void*)(o & (~1));
9821 o_conv.is_owned = (o & 1) || (o == 0);
9822 o_conv = GossipTimestampFilter_clone(&o_conv);
9823 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9824 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
9825 return (long)ret_conv;
9828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9829 LDKDecodeError e_conv;
9830 e_conv.inner = (void*)(e & (~1));
9831 e_conv.is_owned = (e & 1) || (e == 0);
9832 e_conv = DecodeError_clone(&e_conv);
9833 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9834 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
9835 return (long)ret_conv;
9838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9839 if ((_res & 1) != 0) return;
9840 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
9842 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
9845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9846 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
9847 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9848 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
9849 return (long)ret_conv;
9852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9853 if ((this_ptr & 1) != 0) return;
9854 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9855 FREE((void*)this_ptr);
9856 Event_free(this_ptr_conv);
9859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9860 LDKEvent* orig_conv = (LDKEvent*)orig;
9861 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9862 *ret_copy = Event_clone(orig_conv);
9863 long ret_ref = (long)ret_copy;
9867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
9868 LDKEvent* obj_conv = (LDKEvent*)obj;
9869 LDKCVec_u8Z ret_var = Event_write(obj_conv);
9870 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9871 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9872 CVec_u8Z_free(ret_var);
9876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9877 if ((this_ptr & 1) != 0) return;
9878 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9879 FREE((void*)this_ptr);
9880 MessageSendEvent_free(this_ptr_conv);
9883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9884 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9885 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9886 *ret_copy = MessageSendEvent_clone(orig_conv);
9887 long ret_ref = (long)ret_copy;
9891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9892 if ((this_ptr & 1) != 0) return;
9893 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9894 FREE((void*)this_ptr);
9895 MessageSendEventsProvider_free(this_ptr_conv);
9898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9899 if ((this_ptr & 1) != 0) return;
9900 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9901 FREE((void*)this_ptr);
9902 EventsProvider_free(this_ptr_conv);
9905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9906 if ((this_ptr & 1) != 0) return;
9907 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9908 FREE((void*)this_ptr);
9909 APIError_free(this_ptr_conv);
9912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9913 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9914 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9915 *ret_copy = APIError_clone(orig_conv);
9916 long ret_ref = (long)ret_copy;
9920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9921 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9922 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
9926 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
9927 jclass ret_conv = LDKLevel_to_java(env, Level_max());
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9932 if ((this_ptr & 1) != 0) return;
9933 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9934 FREE((void*)this_ptr);
9935 Logger_free(this_ptr_conv);
9938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
9939 LDKChannelHandshakeConfig this_obj_conv;
9940 this_obj_conv.inner = (void*)(this_obj & (~1));
9941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9942 ChannelHandshakeConfig_free(this_obj_conv);
9945 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9946 LDKChannelHandshakeConfig this_ptr_conv;
9947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9948 this_ptr_conv.is_owned = false;
9949 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9954 LDKChannelHandshakeConfig this_ptr_conv;
9955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9956 this_ptr_conv.is_owned = false;
9957 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9960 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9961 LDKChannelHandshakeConfig this_ptr_conv;
9962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9963 this_ptr_conv.is_owned = false;
9964 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9968 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) {
9969 LDKChannelHandshakeConfig this_ptr_conv;
9970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9971 this_ptr_conv.is_owned = false;
9972 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9976 LDKChannelHandshakeConfig this_ptr_conv;
9977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9978 this_ptr_conv.is_owned = false;
9979 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9983 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) {
9984 LDKChannelHandshakeConfig this_ptr_conv;
9985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9986 this_ptr_conv.is_owned = false;
9987 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9990 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) {
9991 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9992 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9993 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9994 long ret_ref = (long)ret_var.inner;
9995 if (ret_var.is_owned) {
10001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10002 LDKChannelHandshakeConfig orig_conv;
10003 orig_conv.inner = (void*)(orig & (~1));
10004 orig_conv.is_owned = false;
10005 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
10016 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
10017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10019 long ret_ref = (long)ret_var.inner;
10020 if (ret_var.is_owned) {
10026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10027 LDKChannelHandshakeLimits this_obj_conv;
10028 this_obj_conv.inner = (void*)(this_obj & (~1));
10029 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10030 ChannelHandshakeLimits_free(this_obj_conv);
10033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10034 LDKChannelHandshakeLimits this_ptr_conv;
10035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10036 this_ptr_conv.is_owned = false;
10037 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
10041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10042 LDKChannelHandshakeLimits this_ptr_conv;
10043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10044 this_ptr_conv.is_owned = false;
10045 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
10048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10049 LDKChannelHandshakeLimits this_ptr_conv;
10050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10051 this_ptr_conv.is_owned = false;
10052 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
10056 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) {
10057 LDKChannelHandshakeLimits this_ptr_conv;
10058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10059 this_ptr_conv.is_owned = false;
10060 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
10063 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) {
10064 LDKChannelHandshakeLimits this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = false;
10067 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
10071 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) {
10072 LDKChannelHandshakeLimits this_ptr_conv;
10073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10074 this_ptr_conv.is_owned = false;
10075 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10079 LDKChannelHandshakeLimits this_ptr_conv;
10080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10081 this_ptr_conv.is_owned = false;
10082 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
10086 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) {
10087 LDKChannelHandshakeLimits this_ptr_conv;
10088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10089 this_ptr_conv.is_owned = false;
10090 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
10093 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10094 LDKChannelHandshakeLimits this_ptr_conv;
10095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10096 this_ptr_conv.is_owned = false;
10097 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
10101 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) {
10102 LDKChannelHandshakeLimits this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = false;
10105 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10109 LDKChannelHandshakeLimits this_ptr_conv;
10110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10111 this_ptr_conv.is_owned = false;
10112 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
10116 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) {
10117 LDKChannelHandshakeLimits this_ptr_conv;
10118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10119 this_ptr_conv.is_owned = false;
10120 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
10123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10124 LDKChannelHandshakeLimits this_ptr_conv;
10125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10126 this_ptr_conv.is_owned = false;
10127 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
10131 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) {
10132 LDKChannelHandshakeLimits this_ptr_conv;
10133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10134 this_ptr_conv.is_owned = false;
10135 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
10138 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10139 LDKChannelHandshakeLimits this_ptr_conv;
10140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10141 this_ptr_conv.is_owned = false;
10142 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
10146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10147 LDKChannelHandshakeLimits this_ptr_conv;
10148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10149 this_ptr_conv.is_owned = false;
10150 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
10153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
10154 LDKChannelHandshakeLimits this_ptr_conv;
10155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10156 this_ptr_conv.is_owned = false;
10157 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
10161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10162 LDKChannelHandshakeLimits this_ptr_conv;
10163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10164 this_ptr_conv.is_owned = false;
10165 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
10168 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10169 LDKChannelHandshakeLimits this_ptr_conv;
10170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10171 this_ptr_conv.is_owned = false;
10172 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
10176 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) {
10177 LDKChannelHandshakeLimits this_ptr_conv;
10178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10179 this_ptr_conv.is_owned = false;
10180 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
10183 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) {
10184 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);
10185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10187 long ret_ref = (long)ret_var.inner;
10188 if (ret_var.is_owned) {
10194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10195 LDKChannelHandshakeLimits orig_conv;
10196 orig_conv.inner = (void*)(orig & (~1));
10197 orig_conv.is_owned = false;
10198 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
10199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10201 long ret_ref = (long)ret_var.inner;
10202 if (ret_var.is_owned) {
10208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
10209 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
10210 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10211 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10212 long ret_ref = (long)ret_var.inner;
10213 if (ret_var.is_owned) {
10219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10220 LDKChannelConfig this_obj_conv;
10221 this_obj_conv.inner = (void*)(this_obj & (~1));
10222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10223 ChannelConfig_free(this_obj_conv);
10226 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
10227 LDKChannelConfig this_ptr_conv;
10228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10229 this_ptr_conv.is_owned = false;
10230 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
10234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10235 LDKChannelConfig this_ptr_conv;
10236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10237 this_ptr_conv.is_owned = false;
10238 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
10241 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
10242 LDKChannelConfig this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = false;
10245 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10250 LDKChannelConfig this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = false;
10253 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
10256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
10257 LDKChannelConfig this_ptr_conv;
10258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10259 this_ptr_conv.is_owned = false;
10260 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
10264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10265 LDKChannelConfig this_ptr_conv;
10266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10267 this_ptr_conv.is_owned = false;
10268 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
10271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10272 LDKChannelConfig this_ptr_conv;
10273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10274 this_ptr_conv.is_owned = false;
10275 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
10279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10280 LDKChannelConfig this_ptr_conv;
10281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10282 this_ptr_conv.is_owned = false;
10283 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
10286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
10287 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
10288 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10289 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10290 long ret_ref = (long)ret_var.inner;
10291 if (ret_var.is_owned) {
10297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10298 LDKChannelConfig orig_conv;
10299 orig_conv.inner = (void*)(orig & (~1));
10300 orig_conv.is_owned = false;
10301 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
10302 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10303 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10304 long ret_ref = (long)ret_var.inner;
10305 if (ret_var.is_owned) {
10311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
10312 LDKChannelConfig ret_var = ChannelConfig_default();
10313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10315 long ret_ref = (long)ret_var.inner;
10316 if (ret_var.is_owned) {
10322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
10323 LDKChannelConfig obj_conv;
10324 obj_conv.inner = (void*)(obj & (~1));
10325 obj_conv.is_owned = false;
10326 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
10327 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10328 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10329 CVec_u8Z_free(ret_var);
10333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10334 LDKu8slice ser_ref;
10335 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10336 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10337 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10338 *ret_conv = ChannelConfig_read(ser_ref);
10339 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10340 return (long)ret_conv;
10343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10344 LDKUserConfig this_obj_conv;
10345 this_obj_conv.inner = (void*)(this_obj & (~1));
10346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10347 UserConfig_free(this_obj_conv);
10350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
10351 LDKUserConfig this_ptr_conv;
10352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10353 this_ptr_conv.is_owned = false;
10354 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
10355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10357 long ret_ref = (long)ret_var.inner;
10358 if (ret_var.is_owned) {
10364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10365 LDKUserConfig this_ptr_conv;
10366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10367 this_ptr_conv.is_owned = false;
10368 LDKChannelHandshakeConfig val_conv;
10369 val_conv.inner = (void*)(val & (~1));
10370 val_conv.is_owned = (val & 1) || (val == 0);
10371 val_conv = ChannelHandshakeConfig_clone(&val_conv);
10372 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
10375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
10376 LDKUserConfig this_ptr_conv;
10377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10378 this_ptr_conv.is_owned = false;
10379 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
10380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10382 long ret_ref = (long)ret_var.inner;
10383 if (ret_var.is_owned) {
10389 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) {
10390 LDKUserConfig this_ptr_conv;
10391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10392 this_ptr_conv.is_owned = false;
10393 LDKChannelHandshakeLimits val_conv;
10394 val_conv.inner = (void*)(val & (~1));
10395 val_conv.is_owned = (val & 1) || (val == 0);
10396 val_conv = ChannelHandshakeLimits_clone(&val_conv);
10397 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
10400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
10401 LDKUserConfig this_ptr_conv;
10402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10403 this_ptr_conv.is_owned = false;
10404 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
10405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10407 long ret_ref = (long)ret_var.inner;
10408 if (ret_var.is_owned) {
10414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10415 LDKUserConfig this_ptr_conv;
10416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10417 this_ptr_conv.is_owned = false;
10418 LDKChannelConfig val_conv;
10419 val_conv.inner = (void*)(val & (~1));
10420 val_conv.is_owned = (val & 1) || (val == 0);
10421 val_conv = ChannelConfig_clone(&val_conv);
10422 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
10425 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) {
10426 LDKChannelHandshakeConfig own_channel_config_arg_conv;
10427 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
10428 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
10429 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
10430 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
10431 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
10432 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
10433 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
10434 LDKChannelConfig channel_options_arg_conv;
10435 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
10436 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
10437 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
10438 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
10439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10441 long ret_ref = (long)ret_var.inner;
10442 if (ret_var.is_owned) {
10448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10449 LDKUserConfig orig_conv;
10450 orig_conv.inner = (void*)(orig & (~1));
10451 orig_conv.is_owned = false;
10452 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
10453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10455 long ret_ref = (long)ret_var.inner;
10456 if (ret_var.is_owned) {
10462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
10463 LDKUserConfig ret_var = UserConfig_default();
10464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10466 long ret_ref = (long)ret_var.inner;
10467 if (ret_var.is_owned) {
10473 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10474 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
10475 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
10479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10480 if ((this_ptr & 1) != 0) return;
10481 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
10482 FREE((void*)this_ptr);
10483 Access_free(this_ptr_conv);
10486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10487 if ((this_ptr & 1) != 0) return;
10488 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
10489 FREE((void*)this_ptr);
10490 Listen_free(this_ptr_conv);
10493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10494 if ((this_ptr & 1) != 0) return;
10495 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
10496 FREE((void*)this_ptr);
10497 Watch_free(this_ptr_conv);
10500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10501 if ((this_ptr & 1) != 0) return;
10502 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
10503 FREE((void*)this_ptr);
10504 Filter_free(this_ptr_conv);
10507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10508 if ((this_ptr & 1) != 0) return;
10509 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
10510 FREE((void*)this_ptr);
10511 BroadcasterInterface_free(this_ptr_conv);
10514 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10515 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
10516 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
10520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10521 if ((this_ptr & 1) != 0) return;
10522 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
10523 FREE((void*)this_ptr);
10524 FeeEstimator_free(this_ptr_conv);
10527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10528 LDKChainMonitor this_obj_conv;
10529 this_obj_conv.inner = (void*)(this_obj & (~1));
10530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10531 ChainMonitor_free(this_obj_conv);
10534 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) {
10535 LDKChainMonitor this_arg_conv;
10536 this_arg_conv.inner = (void*)(this_arg & (~1));
10537 this_arg_conv.is_owned = false;
10538 unsigned char header_arr[80];
10539 CHECK((*env)->GetArrayLength(env, header) == 80);
10540 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10541 unsigned char (*header_ref)[80] = &header_arr;
10542 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10543 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10544 if (txdata_constr.datalen > 0)
10545 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10547 txdata_constr.data = NULL;
10548 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10549 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10550 int64_t txdata_conv_24 = txdata_vals[y];
10551 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10552 FREE((void*)txdata_conv_24);
10553 txdata_constr.data[y] = txdata_conv_24_conv;
10555 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10556 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10559 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) {
10560 LDKChainMonitor this_arg_conv;
10561 this_arg_conv.inner = (void*)(this_arg & (~1));
10562 this_arg_conv.is_owned = false;
10563 unsigned char header_arr[80];
10564 CHECK((*env)->GetArrayLength(env, header) == 80);
10565 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10566 unsigned char (*header_ref)[80] = &header_arr;
10567 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
10570 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) {
10571 LDKFilter *chain_source_conv_ptr = NULL;
10572 if (chain_source != 0) {
10573 LDKFilter chain_source_conv;
10574 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
10575 if (chain_source_conv.free == LDKFilter_JCalls_free) {
10576 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10577 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
10579 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10580 *chain_source_conv_ptr = chain_source_conv;
10582 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10583 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10584 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10585 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10587 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10588 if (logger_conv.free == LDKLogger_JCalls_free) {
10589 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10590 LDKLogger_JCalls_clone(logger_conv.this_arg);
10592 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10593 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
10594 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10595 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
10597 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10598 if (persister_conv.free == LDKPersist_JCalls_free) {
10599 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10600 LDKPersist_JCalls_clone(persister_conv.this_arg);
10602 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10605 long ret_ref = (long)ret_var.inner;
10606 if (ret_var.is_owned) {
10612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10613 LDKChainMonitor this_arg_conv;
10614 this_arg_conv.inner = (void*)(this_arg & (~1));
10615 this_arg_conv.is_owned = false;
10616 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10617 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
10622 LDKChainMonitor this_arg_conv;
10623 this_arg_conv.inner = (void*)(this_arg & (~1));
10624 this_arg_conv.is_owned = false;
10625 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10626 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10631 LDKChannelMonitorUpdate this_obj_conv;
10632 this_obj_conv.inner = (void*)(this_obj & (~1));
10633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10634 ChannelMonitorUpdate_free(this_obj_conv);
10637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10638 LDKChannelMonitorUpdate this_ptr_conv;
10639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10640 this_ptr_conv.is_owned = false;
10641 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10646 LDKChannelMonitorUpdate this_ptr_conv;
10647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10648 this_ptr_conv.is_owned = false;
10649 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10653 LDKChannelMonitorUpdate orig_conv;
10654 orig_conv.inner = (void*)(orig & (~1));
10655 orig_conv.is_owned = false;
10656 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10659 long ret_ref = (long)ret_var.inner;
10660 if (ret_var.is_owned) {
10666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10667 LDKChannelMonitorUpdate obj_conv;
10668 obj_conv.inner = (void*)(obj & (~1));
10669 obj_conv.is_owned = false;
10670 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10673 CVec_u8Z_free(ret_var);
10677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10678 LDKu8slice ser_ref;
10679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10681 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10682 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10684 return (long)ret_conv;
10687 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10688 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10689 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
10693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10694 LDKMonitorUpdateError this_obj_conv;
10695 this_obj_conv.inner = (void*)(this_obj & (~1));
10696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10697 MonitorUpdateError_free(this_obj_conv);
10700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10701 LDKMonitorUpdateError orig_conv;
10702 orig_conv.inner = (void*)(orig & (~1));
10703 orig_conv.is_owned = false;
10704 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
10705 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10706 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10707 long ret_ref = (long)ret_var.inner;
10708 if (ret_var.is_owned) {
10714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10715 if ((this_ptr & 1) != 0) return;
10716 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
10717 FREE((void*)this_ptr);
10718 MonitorEvent_free(this_ptr_conv);
10721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10722 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
10723 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10724 *ret_copy = MonitorEvent_clone(orig_conv);
10725 long ret_ref = (long)ret_copy;
10729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10730 LDKHTLCUpdate this_obj_conv;
10731 this_obj_conv.inner = (void*)(this_obj & (~1));
10732 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10733 HTLCUpdate_free(this_obj_conv);
10736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10737 LDKHTLCUpdate orig_conv;
10738 orig_conv.inner = (void*)(orig & (~1));
10739 orig_conv.is_owned = false;
10740 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10743 long ret_ref = (long)ret_var.inner;
10744 if (ret_var.is_owned) {
10750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10751 LDKHTLCUpdate obj_conv;
10752 obj_conv.inner = (void*)(obj & (~1));
10753 obj_conv.is_owned = false;
10754 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
10755 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10756 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10757 CVec_u8Z_free(ret_var);
10761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10762 LDKu8slice ser_ref;
10763 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10764 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10765 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10766 *ret_conv = HTLCUpdate_read(ser_ref);
10767 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10768 return (long)ret_conv;
10771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10772 LDKChannelMonitor this_obj_conv;
10773 this_obj_conv.inner = (void*)(this_obj & (~1));
10774 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10775 ChannelMonitor_free(this_obj_conv);
10778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10779 LDKChannelMonitor orig_conv;
10780 orig_conv.inner = (void*)(orig & (~1));
10781 orig_conv.is_owned = false;
10782 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10785 long ret_ref = (long)ret_var.inner;
10786 if (ret_var.is_owned) {
10792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
10793 LDKChannelMonitor obj_conv;
10794 obj_conv.inner = (void*)(obj & (~1));
10795 obj_conv.is_owned = false;
10796 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
10797 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10798 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10799 CVec_u8Z_free(ret_var);
10803 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) {
10804 LDKChannelMonitor this_arg_conv;
10805 this_arg_conv.inner = (void*)(this_arg & (~1));
10806 this_arg_conv.is_owned = false;
10807 LDKChannelMonitorUpdate updates_conv;
10808 updates_conv.inner = (void*)(updates & (~1));
10809 updates_conv.is_owned = false;
10810 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10811 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10812 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10813 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10814 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10815 return (long)ret_conv;
10818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10819 LDKChannelMonitor this_arg_conv;
10820 this_arg_conv.inner = (void*)(this_arg & (~1));
10821 this_arg_conv.is_owned = false;
10822 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
10827 LDKChannelMonitor this_arg_conv;
10828 this_arg_conv.inner = (void*)(this_arg & (~1));
10829 this_arg_conv.is_owned = false;
10830 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10831 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10832 return (long)ret_ref;
10835 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10836 LDKChannelMonitor this_arg_conv;
10837 this_arg_conv.inner = (void*)(this_arg & (~1));
10838 this_arg_conv.is_owned = false;
10839 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
10840 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10841 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10842 for (size_t v = 0; v < ret_var.datalen; v++) {
10843 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10844 *ret_conv_47_ref = ret_var.data[v];
10845 ret_arr_ptr[v] = (long)ret_conv_47_ref;
10847 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10848 FREE(ret_var.data);
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
10853 LDKChannelMonitor this_arg_conv;
10854 this_arg_conv.inner = (void*)(this_arg & (~1));
10855 this_arg_conv.is_owned = false;
10856 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
10857 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
10860 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10861 LDKChannelMonitor this_arg_conv;
10862 this_arg_conv.inner = (void*)(this_arg & (~1));
10863 this_arg_conv.is_owned = false;
10864 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10865 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10866 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10867 for (size_t o = 0; o < ret_var.datalen; o++) {
10868 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10869 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10870 long ret_conv_14_ref = (long)ret_conv_14_copy;
10871 ret_arr_ptr[o] = ret_conv_14_ref;
10873 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10874 FREE(ret_var.data);
10878 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10879 LDKChannelMonitor this_arg_conv;
10880 this_arg_conv.inner = (void*)(this_arg & (~1));
10881 this_arg_conv.is_owned = false;
10882 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10883 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10884 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10885 for (size_t h = 0; h < ret_var.datalen; h++) {
10886 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10887 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10888 long ret_conv_7_ref = (long)ret_conv_7_copy;
10889 ret_arr_ptr[h] = ret_conv_7_ref;
10891 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10892 FREE(ret_var.data);
10896 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) {
10897 LDKChannelMonitor this_arg_conv;
10898 this_arg_conv.inner = (void*)(this_arg & (~1));
10899 this_arg_conv.is_owned = false;
10900 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10901 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10902 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10904 for (size_t i = 0; i < ret_var.datalen; i++) {
10905 LDKTransaction ret_conv_8_var = ret_var.data[i];
10906 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
10907 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
10908 Transaction_free(ret_conv_8_var);
10909 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10911 FREE(ret_var.data);
10915 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) {
10916 LDKChannelMonitor this_arg_conv;
10917 this_arg_conv.inner = (void*)(this_arg & (~1));
10918 this_arg_conv.is_owned = false;
10919 unsigned char header_arr[80];
10920 CHECK((*env)->GetArrayLength(env, header) == 80);
10921 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10922 unsigned char (*header_ref)[80] = &header_arr;
10923 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10924 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10925 if (txdata_constr.datalen > 0)
10926 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10928 txdata_constr.data = NULL;
10929 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10930 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10931 int64_t txdata_conv_24 = txdata_vals[y];
10932 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10933 FREE((void*)txdata_conv_24);
10934 txdata_constr.data[y] = txdata_conv_24_conv;
10936 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10937 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10938 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10939 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10940 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10942 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10943 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10944 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10945 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10947 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10948 if (logger_conv.free == LDKLogger_JCalls_free) {
10949 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10950 LDKLogger_JCalls_clone(logger_conv.this_arg);
10952 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);
10953 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10954 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10955 for (size_t u = 0; u < ret_var.datalen; u++) {
10956 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10957 *ret_conv_46_ref = ret_var.data[u];
10958 ret_arr_ptr[u] = (long)ret_conv_46_ref;
10960 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10961 FREE(ret_var.data);
10965 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) {
10966 LDKChannelMonitor this_arg_conv;
10967 this_arg_conv.inner = (void*)(this_arg & (~1));
10968 this_arg_conv.is_owned = false;
10969 unsigned char header_arr[80];
10970 CHECK((*env)->GetArrayLength(env, header) == 80);
10971 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10972 unsigned char (*header_ref)[80] = &header_arr;
10973 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10974 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10975 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10976 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10978 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10979 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10980 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10981 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10983 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10984 if (logger_conv.free == LDKLogger_JCalls_free) {
10985 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10986 LDKLogger_JCalls_clone(logger_conv.this_arg);
10988 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10992 if ((this_ptr & 1) != 0) return;
10993 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10994 FREE((void*)this_ptr);
10995 Persist_free(this_ptr_conv);
10998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
10999 LDKu8slice ser_ref;
11000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11002 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
11003 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11004 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
11005 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11006 return (long)ret_conv;
11009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11010 LDKOutPoint this_obj_conv;
11011 this_obj_conv.inner = (void*)(this_obj & (~1));
11012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11013 OutPoint_free(this_obj_conv);
11016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
11017 LDKOutPoint this_ptr_conv;
11018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11019 this_ptr_conv.is_owned = false;
11020 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
11025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11026 LDKOutPoint this_ptr_conv;
11027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11028 this_ptr_conv.is_owned = false;
11029 LDKThirtyTwoBytes val_ref;
11030 CHECK((*env)->GetArrayLength(env, val) == 32);
11031 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11032 OutPoint_set_txid(&this_ptr_conv, val_ref);
11035 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
11036 LDKOutPoint this_ptr_conv;
11037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11038 this_ptr_conv.is_owned = false;
11039 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
11043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11044 LDKOutPoint this_ptr_conv;
11045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11046 this_ptr_conv.is_owned = false;
11047 OutPoint_set_index(&this_ptr_conv, val);
11050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
11051 LDKThirtyTwoBytes txid_arg_ref;
11052 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
11053 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
11054 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
11055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11057 long ret_ref = (long)ret_var.inner;
11058 if (ret_var.is_owned) {
11064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11065 LDKOutPoint orig_conv;
11066 orig_conv.inner = (void*)(orig & (~1));
11067 orig_conv.is_owned = false;
11068 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
11069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11071 long ret_ref = (long)ret_var.inner;
11072 if (ret_var.is_owned) {
11078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11079 LDKOutPoint this_arg_conv;
11080 this_arg_conv.inner = (void*)(this_arg & (~1));
11081 this_arg_conv.is_owned = false;
11082 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
11087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
11088 LDKOutPoint obj_conv;
11089 obj_conv.inner = (void*)(obj & (~1));
11090 obj_conv.is_owned = false;
11091 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
11092 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11093 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11094 CVec_u8Z_free(ret_var);
11098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11099 LDKu8slice ser_ref;
11100 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11101 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11102 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11103 *ret_conv = OutPoint_read(ser_ref);
11104 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11105 return (long)ret_conv;
11108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11109 LDKDelayedPaymentOutputDescriptor this_obj_conv;
11110 this_obj_conv.inner = (void*)(this_obj & (~1));
11111 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11112 DelayedPaymentOutputDescriptor_free(this_obj_conv);
11115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11116 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11118 this_ptr_conv.is_owned = false;
11119 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11120 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11121 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11122 long ret_ref = (long)ret_var.inner;
11123 if (ret_var.is_owned) {
11129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11130 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11132 this_ptr_conv.is_owned = false;
11133 LDKOutPoint val_conv;
11134 val_conv.inner = (void*)(val & (~1));
11135 val_conv.is_owned = (val & 1) || (val == 0);
11136 val_conv = OutPoint_clone(&val_conv);
11137 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11141 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11143 this_ptr_conv.is_owned = false;
11144 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
11149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11150 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11152 this_ptr_conv.is_owned = false;
11153 LDKPublicKey val_ref;
11154 CHECK((*env)->GetArrayLength(env, val) == 33);
11155 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11156 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
11159 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
11160 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11162 this_ptr_conv.is_owned = false;
11163 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
11167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11168 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11170 this_ptr_conv.is_owned = false;
11171 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
11174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11175 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11177 this_ptr_conv.is_owned = false;
11178 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11180 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
11184 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11186 this_ptr_conv.is_owned = false;
11187 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
11192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11193 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11195 this_ptr_conv.is_owned = false;
11196 LDKPublicKey val_ref;
11197 CHECK((*env)->GetArrayLength(env, val) == 33);
11198 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11199 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
11202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11203 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11205 this_ptr_conv.is_owned = false;
11206 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11207 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11212 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11214 this_ptr_conv.is_owned = false;
11215 LDKThirtyTwoBytes val_ref;
11216 CHECK((*env)->GetArrayLength(env, val) == 32);
11217 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11218 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11222 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11224 this_ptr_conv.is_owned = false;
11225 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11230 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11232 this_ptr_conv.is_owned = false;
11233 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11236 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) {
11237 LDKOutPoint outpoint_arg_conv;
11238 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11239 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11240 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11241 LDKPublicKey per_commitment_point_arg_ref;
11242 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
11243 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11244 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11245 FREE((void*)output_arg);
11246 LDKPublicKey revocation_pubkey_arg_ref;
11247 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
11248 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
11249 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11250 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11251 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11252 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);
11253 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11254 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11255 long ret_ref = (long)ret_var.inner;
11256 if (ret_var.is_owned) {
11262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11263 LDKDelayedPaymentOutputDescriptor orig_conv;
11264 orig_conv.inner = (void*)(orig & (~1));
11265 orig_conv.is_owned = false;
11266 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
11267 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11268 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11269 long ret_ref = (long)ret_var.inner;
11270 if (ret_var.is_owned) {
11276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11277 LDKStaticPaymentOutputDescriptor this_obj_conv;
11278 this_obj_conv.inner = (void*)(this_obj & (~1));
11279 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11280 StaticPaymentOutputDescriptor_free(this_obj_conv);
11283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11284 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11286 this_ptr_conv.is_owned = false;
11287 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11288 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11289 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11290 long ret_ref = (long)ret_var.inner;
11291 if (ret_var.is_owned) {
11297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11298 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11300 this_ptr_conv.is_owned = false;
11301 LDKOutPoint val_conv;
11302 val_conv.inner = (void*)(val & (~1));
11303 val_conv.is_owned = (val & 1) || (val == 0);
11304 val_conv = OutPoint_clone(&val_conv);
11305 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11309 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11311 this_ptr_conv.is_owned = false;
11312 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11314 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11318 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11320 this_ptr_conv.is_owned = false;
11321 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11327 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11329 this_ptr_conv.is_owned = false;
11330 LDKThirtyTwoBytes val_ref;
11331 CHECK((*env)->GetArrayLength(env, val) == 32);
11332 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11333 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11337 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11339 this_ptr_conv.is_owned = false;
11340 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11345 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11347 this_ptr_conv.is_owned = false;
11348 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11351 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) {
11352 LDKOutPoint outpoint_arg_conv;
11353 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11354 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11355 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11356 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11357 FREE((void*)output_arg);
11358 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11359 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11360 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11361 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
11362 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11363 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11364 long ret_ref = (long)ret_var.inner;
11365 if (ret_var.is_owned) {
11371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11372 LDKStaticPaymentOutputDescriptor orig_conv;
11373 orig_conv.inner = (void*)(orig & (~1));
11374 orig_conv.is_owned = false;
11375 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
11376 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11377 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11378 long ret_ref = (long)ret_var.inner;
11379 if (ret_var.is_owned) {
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11386 if ((this_ptr & 1) != 0) return;
11387 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
11388 FREE((void*)this_ptr);
11389 SpendableOutputDescriptor_free(this_ptr_conv);
11392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11393 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
11394 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
11395 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
11396 long ret_ref = (long)ret_copy;
11400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
11401 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
11402 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
11403 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11404 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11405 CVec_u8Z_free(ret_var);
11409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11410 LDKu8slice ser_ref;
11411 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11412 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11413 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11414 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
11415 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11416 return (long)ret_conv;
11419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11420 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
11421 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11422 *ret = Sign_clone(orig_conv);
11426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11427 if ((this_ptr & 1) != 0) return;
11428 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
11429 FREE((void*)this_ptr);
11430 Sign_free(this_ptr_conv);
11433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11434 if ((this_ptr & 1) != 0) return;
11435 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
11436 FREE((void*)this_ptr);
11437 KeysInterface_free(this_ptr_conv);
11440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11441 LDKInMemorySigner this_obj_conv;
11442 this_obj_conv.inner = (void*)(this_obj & (~1));
11443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11444 InMemorySigner_free(this_obj_conv);
11447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11448 LDKInMemorySigner this_ptr_conv;
11449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11450 this_ptr_conv.is_owned = false;
11451 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11452 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
11456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11457 LDKInMemorySigner this_ptr_conv;
11458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11459 this_ptr_conv.is_owned = false;
11460 LDKSecretKey val_ref;
11461 CHECK((*env)->GetArrayLength(env, val) == 32);
11462 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11463 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
11466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11467 LDKInMemorySigner this_ptr_conv;
11468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11469 this_ptr_conv.is_owned = false;
11470 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
11475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11476 LDKInMemorySigner this_ptr_conv;
11477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11478 this_ptr_conv.is_owned = false;
11479 LDKSecretKey val_ref;
11480 CHECK((*env)->GetArrayLength(env, val) == 32);
11481 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11482 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
11485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11486 LDKInMemorySigner this_ptr_conv;
11487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11488 this_ptr_conv.is_owned = false;
11489 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11490 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
11494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11495 LDKInMemorySigner this_ptr_conv;
11496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11497 this_ptr_conv.is_owned = false;
11498 LDKSecretKey val_ref;
11499 CHECK((*env)->GetArrayLength(env, val) == 32);
11500 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11501 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
11504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11505 LDKInMemorySigner this_ptr_conv;
11506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11507 this_ptr_conv.is_owned = false;
11508 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11509 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
11513 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) {
11514 LDKInMemorySigner this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = false;
11517 LDKSecretKey val_ref;
11518 CHECK((*env)->GetArrayLength(env, val) == 32);
11519 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11520 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
11523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11524 LDKInMemorySigner this_ptr_conv;
11525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11526 this_ptr_conv.is_owned = false;
11527 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11528 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
11532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11533 LDKInMemorySigner this_ptr_conv;
11534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11535 this_ptr_conv.is_owned = false;
11536 LDKSecretKey val_ref;
11537 CHECK((*env)->GetArrayLength(env, val) == 32);
11538 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11539 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
11543 LDKInMemorySigner this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11547 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
11551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11552 LDKInMemorySigner this_ptr_conv;
11553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11554 this_ptr_conv.is_owned = false;
11555 LDKThirtyTwoBytes val_ref;
11556 CHECK((*env)->GetArrayLength(env, val) == 32);
11557 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11558 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11562 LDKInMemorySigner orig_conv;
11563 orig_conv.inner = (void*)(orig & (~1));
11564 orig_conv.is_owned = false;
11565 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11566 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11567 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11568 long ret_ref = (long)ret_var.inner;
11569 if (ret_var.is_owned) {
11575 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) {
11576 LDKSecretKey funding_key_ref;
11577 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
11578 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
11579 LDKSecretKey revocation_base_key_ref;
11580 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
11581 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
11582 LDKSecretKey payment_key_ref;
11583 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
11584 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
11585 LDKSecretKey delayed_payment_base_key_ref;
11586 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
11587 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
11588 LDKSecretKey htlc_base_key_ref;
11589 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
11590 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
11591 LDKThirtyTwoBytes commitment_seed_ref;
11592 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
11593 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
11594 LDKThirtyTwoBytes channel_keys_id_ref;
11595 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
11596 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
11597 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);
11598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11600 long ret_ref = (long)ret_var.inner;
11601 if (ret_var.is_owned) {
11607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
11608 LDKInMemorySigner this_arg_conv;
11609 this_arg_conv.inner = (void*)(this_arg & (~1));
11610 this_arg_conv.is_owned = false;
11611 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11612 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11613 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11614 long ret_ref = (long)ret_var.inner;
11615 if (ret_var.is_owned) {
11621 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11622 LDKInMemorySigner this_arg_conv;
11623 this_arg_conv.inner = (void*)(this_arg & (~1));
11624 this_arg_conv.is_owned = false;
11625 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11629 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11630 LDKInMemorySigner this_arg_conv;
11631 this_arg_conv.inner = (void*)(this_arg & (~1));
11632 this_arg_conv.is_owned = false;
11633 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
11638 LDKInMemorySigner this_arg_conv;
11639 this_arg_conv.inner = (void*)(this_arg & (~1));
11640 this_arg_conv.is_owned = false;
11641 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
11646 LDKInMemorySigner this_arg_conv;
11647 this_arg_conv.inner = (void*)(this_arg & (~1));
11648 this_arg_conv.is_owned = false;
11649 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11652 long ret_ref = (long)ret_var.inner;
11653 if (ret_var.is_owned) {
11659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
11660 LDKInMemorySigner this_arg_conv;
11661 this_arg_conv.inner = (void*)(this_arg & (~1));
11662 this_arg_conv.is_owned = false;
11663 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11664 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11665 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11666 long ret_ref = (long)ret_var.inner;
11667 if (ret_var.is_owned) {
11673 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) {
11674 LDKInMemorySigner this_arg_conv;
11675 this_arg_conv.inner = (void*)(this_arg & (~1));
11676 this_arg_conv.is_owned = false;
11677 LDKTransaction spend_tx_ref;
11678 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11679 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11680 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11681 spend_tx_ref.data_is_owned = true;
11682 LDKStaticPaymentOutputDescriptor descriptor_conv;
11683 descriptor_conv.inner = (void*)(descriptor & (~1));
11684 descriptor_conv.is_owned = false;
11685 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11686 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11687 return (long)ret_conv;
11690 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) {
11691 LDKInMemorySigner this_arg_conv;
11692 this_arg_conv.inner = (void*)(this_arg & (~1));
11693 this_arg_conv.is_owned = false;
11694 LDKTransaction spend_tx_ref;
11695 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11696 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11697 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11698 spend_tx_ref.data_is_owned = true;
11699 LDKDelayedPaymentOutputDescriptor descriptor_conv;
11700 descriptor_conv.inner = (void*)(descriptor & (~1));
11701 descriptor_conv.is_owned = false;
11702 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11703 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11704 return (long)ret_conv;
11707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
11708 LDKInMemorySigner this_arg_conv;
11709 this_arg_conv.inner = (void*)(this_arg & (~1));
11710 this_arg_conv.is_owned = false;
11711 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11712 *ret = InMemorySigner_as_Sign(&this_arg_conv);
11716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
11717 LDKInMemorySigner obj_conv;
11718 obj_conv.inner = (void*)(obj & (~1));
11719 obj_conv.is_owned = false;
11720 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
11721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11723 CVec_u8Z_free(ret_var);
11727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11728 LDKu8slice ser_ref;
11729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11731 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11732 *ret_conv = InMemorySigner_read(ser_ref);
11733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11734 return (long)ret_conv;
11737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11738 LDKKeysManager this_obj_conv;
11739 this_obj_conv.inner = (void*)(this_obj & (~1));
11740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11741 KeysManager_free(this_obj_conv);
11744 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) {
11745 unsigned char seed_arr[32];
11746 CHECK((*env)->GetArrayLength(env, seed) == 32);
11747 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
11748 unsigned char (*seed_ref)[32] = &seed_arr;
11749 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
11750 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11751 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11752 long ret_ref = (long)ret_var.inner;
11753 if (ret_var.is_owned) {
11759 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) {
11760 LDKKeysManager this_arg_conv;
11761 this_arg_conv.inner = (void*)(this_arg & (~1));
11762 this_arg_conv.is_owned = false;
11763 unsigned char params_arr[32];
11764 CHECK((*env)->GetArrayLength(env, params) == 32);
11765 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
11766 unsigned char (*params_ref)[32] = ¶ms_arr;
11767 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
11768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11770 long ret_ref = (long)ret_var.inner;
11771 if (ret_var.is_owned) {
11777 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) {
11778 LDKKeysManager this_arg_conv;
11779 this_arg_conv.inner = (void*)(this_arg & (~1));
11780 this_arg_conv.is_owned = false;
11781 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
11782 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
11783 if (descriptors_constr.datalen > 0)
11784 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11786 descriptors_constr.data = NULL;
11787 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
11788 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
11789 int64_t descriptors_conv_27 = descriptors_vals[b];
11790 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
11791 FREE((void*)descriptors_conv_27);
11792 descriptors_constr.data[b] = descriptors_conv_27_conv;
11794 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
11795 LDKCVec_TxOutZ outputs_constr;
11796 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
11797 if (outputs_constr.datalen > 0)
11798 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11800 outputs_constr.data = NULL;
11801 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
11802 for (size_t h = 0; h < outputs_constr.datalen; h++) {
11803 int64_t outputs_conv_7 = outputs_vals[h];
11804 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
11805 FREE((void*)outputs_conv_7);
11806 outputs_constr.data[h] = outputs_conv_7_conv;
11808 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
11809 LDKCVec_u8Z change_destination_script_ref;
11810 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
11811 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
11812 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
11813 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11814 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
11815 return (long)ret_conv;
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
11819 LDKKeysManager this_arg_conv;
11820 this_arg_conv.inner = (void*)(this_arg & (~1));
11821 this_arg_conv.is_owned = false;
11822 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
11823 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
11827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11828 LDKChannelManager this_obj_conv;
11829 this_obj_conv.inner = (void*)(this_obj & (~1));
11830 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11831 ChannelManager_free(this_obj_conv);
11834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11835 LDKChainParameters this_obj_conv;
11836 this_obj_conv.inner = (void*)(this_obj & (~1));
11837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11838 ChainParameters_free(this_obj_conv);
11841 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
11842 LDKChainParameters this_ptr_conv;
11843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11844 this_ptr_conv.is_owned = false;
11845 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
11849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
11850 LDKChainParameters this_ptr_conv;
11851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11852 this_ptr_conv.is_owned = false;
11853 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
11854 ChainParameters_set_network(&this_ptr_conv, val_conv);
11857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11858 LDKChainParameters this_ptr_conv;
11859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11860 this_ptr_conv.is_owned = false;
11861 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11862 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChainParameters_get_latest_hash(&this_ptr_conv));
11866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11867 LDKChainParameters this_ptr_conv;
11868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11869 this_ptr_conv.is_owned = false;
11870 LDKThirtyTwoBytes val_ref;
11871 CHECK((*env)->GetArrayLength(env, val) == 32);
11872 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11873 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
11876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
11877 LDKChainParameters this_ptr_conv;
11878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11879 this_ptr_conv.is_owned = false;
11880 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
11884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11885 LDKChainParameters this_ptr_conv;
11886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11887 this_ptr_conv.is_owned = false;
11888 ChainParameters_set_latest_height(&this_ptr_conv, val);
11891 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) {
11892 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
11893 LDKThirtyTwoBytes latest_hash_arg_ref;
11894 CHECK((*env)->GetArrayLength(env, latest_hash_arg) == 32);
11895 (*env)->GetByteArrayRegion(env, latest_hash_arg, 0, 32, latest_hash_arg_ref.data);
11896 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
11897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11899 long ret_ref = (long)ret_var.inner;
11900 if (ret_var.is_owned) {
11906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11907 LDKChannelDetails this_obj_conv;
11908 this_obj_conv.inner = (void*)(this_obj & (~1));
11909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11910 ChannelDetails_free(this_obj_conv);
11913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11914 LDKChannelDetails this_ptr_conv;
11915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11916 this_ptr_conv.is_owned = false;
11917 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11918 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
11922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11923 LDKChannelDetails this_ptr_conv;
11924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11925 this_ptr_conv.is_owned = false;
11926 LDKThirtyTwoBytes val_ref;
11927 CHECK((*env)->GetArrayLength(env, val) == 32);
11928 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11929 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11933 LDKChannelDetails this_ptr_conv;
11934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11935 this_ptr_conv.is_owned = false;
11936 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11937 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
11941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11942 LDKChannelDetails this_ptr_conv;
11943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11944 this_ptr_conv.is_owned = false;
11945 LDKPublicKey val_ref;
11946 CHECK((*env)->GetArrayLength(env, val) == 33);
11947 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11948 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11952 LDKChannelDetails this_ptr_conv;
11953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11954 this_ptr_conv.is_owned = false;
11955 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11958 long ret_ref = (long)ret_var.inner;
11959 if (ret_var.is_owned) {
11965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11966 LDKChannelDetails this_ptr_conv;
11967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11968 this_ptr_conv.is_owned = false;
11969 LDKInitFeatures val_conv;
11970 val_conv.inner = (void*)(val & (~1));
11971 val_conv.is_owned = (val & 1) || (val == 0);
11972 val_conv = InitFeatures_clone(&val_conv);
11973 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11977 LDKChannelDetails this_ptr_conv;
11978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11979 this_ptr_conv.is_owned = false;
11980 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11985 LDKChannelDetails this_ptr_conv;
11986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11987 this_ptr_conv.is_owned = false;
11988 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11992 LDKChannelDetails this_ptr_conv;
11993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11994 this_ptr_conv.is_owned = false;
11995 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12000 LDKChannelDetails this_ptr_conv;
12001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12002 this_ptr_conv.is_owned = false;
12003 ChannelDetails_set_user_id(&this_ptr_conv, val);
12006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12007 LDKChannelDetails this_ptr_conv;
12008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12009 this_ptr_conv.is_owned = false;
12010 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
12014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12015 LDKChannelDetails this_ptr_conv;
12016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12017 this_ptr_conv.is_owned = false;
12018 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
12021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12022 LDKChannelDetails this_ptr_conv;
12023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12024 this_ptr_conv.is_owned = false;
12025 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
12029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12030 LDKChannelDetails this_ptr_conv;
12031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12032 this_ptr_conv.is_owned = false;
12033 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
12036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
12037 LDKChannelDetails this_ptr_conv;
12038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12039 this_ptr_conv.is_owned = false;
12040 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
12044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12045 LDKChannelDetails this_ptr_conv;
12046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12047 this_ptr_conv.is_owned = false;
12048 ChannelDetails_set_is_live(&this_ptr_conv, val);
12051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12052 LDKChannelDetails orig_conv;
12053 orig_conv.inner = (void*)(orig & (~1));
12054 orig_conv.is_owned = false;
12055 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
12056 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12057 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12058 long ret_ref = (long)ret_var.inner;
12059 if (ret_var.is_owned) {
12065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12066 if ((this_ptr & 1) != 0) return;
12067 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
12068 FREE((void*)this_ptr);
12069 PaymentSendFailure_free(this_ptr_conv);
12072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12073 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
12074 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
12075 *ret_copy = PaymentSendFailure_clone(orig_conv);
12076 long ret_ref = (long)ret_copy;
12080 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) {
12081 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
12082 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
12083 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12084 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
12086 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12087 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12088 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12089 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12091 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12092 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12094 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12096 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12097 if (logger_conv.free == LDKLogger_JCalls_free) {
12098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12099 LDKLogger_JCalls_clone(logger_conv.this_arg);
12101 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12102 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12103 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12104 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12106 LDKUserConfig config_conv;
12107 config_conv.inner = (void*)(config & (~1));
12108 config_conv.is_owned = (config & 1) || (config == 0);
12109 config_conv = UserConfig_clone(&config_conv);
12110 LDKChainParameters params_conv;
12111 params_conv.inner = (void*)(params & (~1));
12112 params_conv.is_owned = (params & 1) || (params == 0);
12113 // Warning: we need a move here but no clone is available for LDKChainParameters
12114 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
12115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12117 long ret_ref = (long)ret_var.inner;
12118 if (ret_var.is_owned) {
12124 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) {
12125 LDKChannelManager this_arg_conv;
12126 this_arg_conv.inner = (void*)(this_arg & (~1));
12127 this_arg_conv.is_owned = false;
12128 LDKPublicKey their_network_key_ref;
12129 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
12130 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
12131 LDKUserConfig override_config_conv;
12132 override_config_conv.inner = (void*)(override_config & (~1));
12133 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
12134 override_config_conv = UserConfig_clone(&override_config_conv);
12135 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12136 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
12137 return (long)ret_conv;
12140 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12141 LDKChannelManager this_arg_conv;
12142 this_arg_conv.inner = (void*)(this_arg & (~1));
12143 this_arg_conv.is_owned = false;
12144 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
12145 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12146 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12147 for (size_t q = 0; q < ret_var.datalen; q++) {
12148 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12149 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12150 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12151 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12152 if (ret_conv_16_var.is_owned) {
12153 ret_conv_16_ref |= 1;
12155 ret_arr_ptr[q] = ret_conv_16_ref;
12157 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12158 FREE(ret_var.data);
12162 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12163 LDKChannelManager this_arg_conv;
12164 this_arg_conv.inner = (void*)(this_arg & (~1));
12165 this_arg_conv.is_owned = false;
12166 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
12167 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12168 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12169 for (size_t q = 0; q < ret_var.datalen; q++) {
12170 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12171 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12172 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12173 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12174 if (ret_conv_16_var.is_owned) {
12175 ret_conv_16_ref |= 1;
12177 ret_arr_ptr[q] = ret_conv_16_ref;
12179 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12180 FREE(ret_var.data);
12184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
12185 LDKChannelManager this_arg_conv;
12186 this_arg_conv.inner = (void*)(this_arg & (~1));
12187 this_arg_conv.is_owned = false;
12188 unsigned char channel_id_arr[32];
12189 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12190 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12191 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12192 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12193 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
12194 return (long)ret_conv;
12197 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) {
12198 LDKChannelManager this_arg_conv;
12199 this_arg_conv.inner = (void*)(this_arg & (~1));
12200 this_arg_conv.is_owned = false;
12201 unsigned char channel_id_arr[32];
12202 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12203 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12204 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12205 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12206 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
12207 return (long)ret_conv;
12210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12211 LDKChannelManager this_arg_conv;
12212 this_arg_conv.inner = (void*)(this_arg & (~1));
12213 this_arg_conv.is_owned = false;
12214 ChannelManager_force_close_all_channels(&this_arg_conv);
12217 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) {
12218 LDKChannelManager this_arg_conv;
12219 this_arg_conv.inner = (void*)(this_arg & (~1));
12220 this_arg_conv.is_owned = false;
12221 LDKRoute route_conv;
12222 route_conv.inner = (void*)(route & (~1));
12223 route_conv.is_owned = false;
12224 LDKThirtyTwoBytes payment_hash_ref;
12225 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12226 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
12227 LDKThirtyTwoBytes payment_secret_ref;
12228 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12229 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12230 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12231 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
12232 return (long)ret_conv;
12235 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) {
12236 LDKChannelManager this_arg_conv;
12237 this_arg_conv.inner = (void*)(this_arg & (~1));
12238 this_arg_conv.is_owned = false;
12239 unsigned char temporary_channel_id_arr[32];
12240 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
12241 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
12242 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
12243 LDKOutPoint funding_txo_conv;
12244 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12245 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
12246 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
12247 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
12250 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) {
12251 LDKChannelManager this_arg_conv;
12252 this_arg_conv.inner = (void*)(this_arg & (~1));
12253 this_arg_conv.is_owned = false;
12254 LDKThreeBytes rgb_ref;
12255 CHECK((*env)->GetArrayLength(env, rgb) == 3);
12256 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
12257 LDKThirtyTwoBytes alias_ref;
12258 CHECK((*env)->GetArrayLength(env, alias) == 32);
12259 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
12260 LDKCVec_NetAddressZ addresses_constr;
12261 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
12262 if (addresses_constr.datalen > 0)
12263 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12265 addresses_constr.data = NULL;
12266 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
12267 for (size_t m = 0; m < addresses_constr.datalen; m++) {
12268 int64_t addresses_conv_12 = addresses_vals[m];
12269 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
12270 FREE((void*)addresses_conv_12);
12271 addresses_constr.data[m] = addresses_conv_12_conv;
12273 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
12274 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
12277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
12278 LDKChannelManager this_arg_conv;
12279 this_arg_conv.inner = (void*)(this_arg & (~1));
12280 this_arg_conv.is_owned = false;
12281 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
12284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
12285 LDKChannelManager this_arg_conv;
12286 this_arg_conv.inner = (void*)(this_arg & (~1));
12287 this_arg_conv.is_owned = false;
12288 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
12291 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) {
12292 LDKChannelManager this_arg_conv;
12293 this_arg_conv.inner = (void*)(this_arg & (~1));
12294 this_arg_conv.is_owned = false;
12295 unsigned char payment_hash_arr[32];
12296 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12297 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
12298 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
12299 LDKThirtyTwoBytes payment_secret_ref;
12300 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12301 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12302 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
12306 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) {
12307 LDKChannelManager this_arg_conv;
12308 this_arg_conv.inner = (void*)(this_arg & (~1));
12309 this_arg_conv.is_owned = false;
12310 LDKThirtyTwoBytes payment_preimage_ref;
12311 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
12312 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
12313 LDKThirtyTwoBytes payment_secret_ref;
12314 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12315 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12316 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
12320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
12321 LDKChannelManager this_arg_conv;
12322 this_arg_conv.inner = (void*)(this_arg & (~1));
12323 this_arg_conv.is_owned = false;
12324 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
12329 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) {
12330 LDKChannelManager this_arg_conv;
12331 this_arg_conv.inner = (void*)(this_arg & (~1));
12332 this_arg_conv.is_owned = false;
12333 LDKOutPoint funding_txo_conv;
12334 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12335 funding_txo_conv.is_owned = false;
12336 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
12339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12340 LDKChannelManager this_arg_conv;
12341 this_arg_conv.inner = (void*)(this_arg & (~1));
12342 this_arg_conv.is_owned = false;
12343 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12344 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
12348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12349 LDKChannelManager this_arg_conv;
12350 this_arg_conv.inner = (void*)(this_arg & (~1));
12351 this_arg_conv.is_owned = false;
12352 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12353 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
12357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
12358 LDKChannelManager this_arg_conv;
12359 this_arg_conv.inner = (void*)(this_arg & (~1));
12360 this_arg_conv.is_owned = false;
12361 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12362 *ret = ChannelManager_as_Listen(&this_arg_conv);
12366 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) {
12367 LDKChannelManager this_arg_conv;
12368 this_arg_conv.inner = (void*)(this_arg & (~1));
12369 this_arg_conv.is_owned = false;
12370 unsigned char header_arr[80];
12371 CHECK((*env)->GetArrayLength(env, header) == 80);
12372 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12373 unsigned char (*header_ref)[80] = &header_arr;
12374 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12375 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12376 if (txdata_constr.datalen > 0)
12377 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12379 txdata_constr.data = NULL;
12380 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12381 for (size_t y = 0; y < txdata_constr.datalen; y++) {
12382 int64_t txdata_conv_24 = txdata_vals[y];
12383 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
12384 FREE((void*)txdata_conv_24);
12385 txdata_constr.data[y] = txdata_conv_24_conv;
12387 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12388 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
12391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
12392 LDKChannelManager this_arg_conv;
12393 this_arg_conv.inner = (void*)(this_arg & (~1));
12394 this_arg_conv.is_owned = false;
12395 unsigned char header_arr[80];
12396 CHECK((*env)->GetArrayLength(env, header) == 80);
12397 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12398 unsigned char (*header_ref)[80] = &header_arr;
12399 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
12402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
12403 LDKChannelManager this_arg_conv;
12404 this_arg_conv.inner = (void*)(this_arg & (~1));
12405 this_arg_conv.is_owned = false;
12406 ChannelManager_await_persistable_update(&this_arg_conv);
12409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
12410 LDKChannelManager this_arg_conv;
12411 this_arg_conv.inner = (void*)(this_arg & (~1));
12412 this_arg_conv.is_owned = false;
12413 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12414 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
12418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
12419 LDKChannelManager obj_conv;
12420 obj_conv.inner = (void*)(obj & (~1));
12421 obj_conv.is_owned = false;
12422 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
12423 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12424 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12425 CVec_u8Z_free(ret_var);
12429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12430 LDKChannelManagerReadArgs this_obj_conv;
12431 this_obj_conv.inner = (void*)(this_obj & (~1));
12432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12433 ChannelManagerReadArgs_free(this_obj_conv);
12436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
12437 LDKChannelManagerReadArgs this_ptr_conv;
12438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12439 this_ptr_conv.is_owned = false;
12440 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12445 LDKChannelManagerReadArgs this_ptr_conv;
12446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12447 this_ptr_conv.is_owned = false;
12448 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12449 if (val_conv.free == LDKKeysInterface_JCalls_free) {
12450 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12451 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
12453 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
12457 LDKChannelManagerReadArgs this_ptr_conv;
12458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12459 this_ptr_conv.is_owned = false;
12460 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12465 LDKChannelManagerReadArgs this_ptr_conv;
12466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12467 this_ptr_conv.is_owned = false;
12468 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12469 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
12470 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12471 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
12473 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
12477 LDKChannelManagerReadArgs this_ptr_conv;
12478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12479 this_ptr_conv.is_owned = false;
12480 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12485 LDKChannelManagerReadArgs this_ptr_conv;
12486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12487 this_ptr_conv.is_owned = false;
12488 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12489 if (val_conv.free == LDKWatch_JCalls_free) {
12490 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12491 LDKWatch_JCalls_clone(val_conv.this_arg);
12493 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
12497 LDKChannelManagerReadArgs this_ptr_conv;
12498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12499 this_ptr_conv.is_owned = false;
12500 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12505 LDKChannelManagerReadArgs this_ptr_conv;
12506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12507 this_ptr_conv.is_owned = false;
12508 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12509 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
12510 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12511 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
12513 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
12517 LDKChannelManagerReadArgs this_ptr_conv;
12518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12519 this_ptr_conv.is_owned = false;
12520 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12525 LDKChannelManagerReadArgs this_ptr_conv;
12526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12527 this_ptr_conv.is_owned = false;
12528 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12529 if (val_conv.free == LDKLogger_JCalls_free) {
12530 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12531 LDKLogger_JCalls_clone(val_conv.this_arg);
12533 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
12537 LDKChannelManagerReadArgs this_ptr_conv;
12538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12539 this_ptr_conv.is_owned = false;
12540 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12541 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12542 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12543 long ret_ref = (long)ret_var.inner;
12544 if (ret_var.is_owned) {
12550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12551 LDKChannelManagerReadArgs this_ptr_conv;
12552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12553 this_ptr_conv.is_owned = false;
12554 LDKUserConfig val_conv;
12555 val_conv.inner = (void*)(val & (~1));
12556 val_conv.is_owned = (val & 1) || (val == 0);
12557 val_conv = UserConfig_clone(&val_conv);
12558 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12561 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) {
12562 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12563 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12564 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12565 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12567 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12568 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
12569 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12570 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
12572 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12573 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12574 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12575 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12577 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12578 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12579 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12580 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12582 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12583 if (logger_conv.free == LDKLogger_JCalls_free) {
12584 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12585 LDKLogger_JCalls_clone(logger_conv.this_arg);
12587 LDKUserConfig default_config_conv;
12588 default_config_conv.inner = (void*)(default_config & (~1));
12589 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12590 default_config_conv = UserConfig_clone(&default_config_conv);
12591 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12592 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
12593 if (channel_monitors_constr.datalen > 0)
12594 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12596 channel_monitors_constr.data = NULL;
12597 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
12598 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12599 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
12600 LDKChannelMonitor channel_monitors_conv_16_conv;
12601 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12602 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12603 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12605 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
12606 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);
12607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12609 long ret_ref = (long)ret_var.inner;
12610 if (ret_var.is_owned) {
12616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
12617 LDKu8slice ser_ref;
12618 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
12619 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
12620 LDKChannelManagerReadArgs arg_conv;
12621 arg_conv.inner = (void*)(arg & (~1));
12622 arg_conv.is_owned = (arg & 1) || (arg == 0);
12623 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12624 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12625 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
12627 return (long)ret_conv;
12630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12631 LDKDecodeError this_obj_conv;
12632 this_obj_conv.inner = (void*)(this_obj & (~1));
12633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12634 DecodeError_free(this_obj_conv);
12637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12638 LDKDecodeError orig_conv;
12639 orig_conv.inner = (void*)(orig & (~1));
12640 orig_conv.is_owned = false;
12641 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12642 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12643 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12644 long ret_ref = (long)ret_var.inner;
12645 if (ret_var.is_owned) {
12651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12652 LDKInit this_obj_conv;
12653 this_obj_conv.inner = (void*)(this_obj & (~1));
12654 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12655 Init_free(this_obj_conv);
12658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
12659 LDKInit this_ptr_conv;
12660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12661 this_ptr_conv.is_owned = false;
12662 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12663 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12664 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12665 long ret_ref = (long)ret_var.inner;
12666 if (ret_var.is_owned) {
12672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12673 LDKInit this_ptr_conv;
12674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12675 this_ptr_conv.is_owned = false;
12676 LDKInitFeatures val_conv;
12677 val_conv.inner = (void*)(val & (~1));
12678 val_conv.is_owned = (val & 1) || (val == 0);
12679 val_conv = InitFeatures_clone(&val_conv);
12680 Init_set_features(&this_ptr_conv, val_conv);
12683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
12684 LDKInitFeatures features_arg_conv;
12685 features_arg_conv.inner = (void*)(features_arg & (~1));
12686 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12687 features_arg_conv = InitFeatures_clone(&features_arg_conv);
12688 LDKInit ret_var = Init_new(features_arg_conv);
12689 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12690 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12691 long ret_ref = (long)ret_var.inner;
12692 if (ret_var.is_owned) {
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12700 orig_conv.inner = (void*)(orig & (~1));
12701 orig_conv.is_owned = false;
12702 LDKInit ret_var = Init_clone(&orig_conv);
12703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12705 long ret_ref = (long)ret_var.inner;
12706 if (ret_var.is_owned) {
12712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12713 LDKErrorMessage this_obj_conv;
12714 this_obj_conv.inner = (void*)(this_obj & (~1));
12715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12716 ErrorMessage_free(this_obj_conv);
12719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12720 LDKErrorMessage this_ptr_conv;
12721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12722 this_ptr_conv.is_owned = false;
12723 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
12728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12729 LDKErrorMessage this_ptr_conv;
12730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12731 this_ptr_conv.is_owned = false;
12732 LDKThirtyTwoBytes val_ref;
12733 CHECK((*env)->GetArrayLength(env, val) == 32);
12734 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12735 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
12738 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
12739 LDKErrorMessage this_ptr_conv;
12740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12741 this_ptr_conv.is_owned = false;
12742 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
12743 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12748 LDKErrorMessage this_ptr_conv;
12749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12750 this_ptr_conv.is_owned = false;
12751 LDKCVec_u8Z val_ref;
12752 val_ref.datalen = (*env)->GetArrayLength(env, val);
12753 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12754 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12755 ErrorMessage_set_data(&this_ptr_conv, val_ref);
12758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
12759 LDKThirtyTwoBytes channel_id_arg_ref;
12760 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12761 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12762 LDKCVec_u8Z data_arg_ref;
12763 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
12764 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12765 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
12766 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
12767 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12768 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12769 long ret_ref = (long)ret_var.inner;
12770 if (ret_var.is_owned) {
12776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12777 LDKErrorMessage orig_conv;
12778 orig_conv.inner = (void*)(orig & (~1));
12779 orig_conv.is_owned = false;
12780 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
12781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12783 long ret_ref = (long)ret_var.inner;
12784 if (ret_var.is_owned) {
12790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12791 LDKPing this_obj_conv;
12792 this_obj_conv.inner = (void*)(this_obj & (~1));
12793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12794 Ping_free(this_obj_conv);
12797 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12798 LDKPing this_ptr_conv;
12799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12800 this_ptr_conv.is_owned = false;
12801 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
12805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12806 LDKPing this_ptr_conv;
12807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12808 this_ptr_conv.is_owned = false;
12809 Ping_set_ponglen(&this_ptr_conv, val);
12812 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12813 LDKPing this_ptr_conv;
12814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12815 this_ptr_conv.is_owned = false;
12816 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
12820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12821 LDKPing this_ptr_conv;
12822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12823 this_ptr_conv.is_owned = false;
12824 Ping_set_byteslen(&this_ptr_conv, val);
12827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
12828 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
12829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12831 long ret_ref = (long)ret_var.inner;
12832 if (ret_var.is_owned) {
12838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12840 orig_conv.inner = (void*)(orig & (~1));
12841 orig_conv.is_owned = false;
12842 LDKPing ret_var = Ping_clone(&orig_conv);
12843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12845 long ret_ref = (long)ret_var.inner;
12846 if (ret_var.is_owned) {
12852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12853 LDKPong this_obj_conv;
12854 this_obj_conv.inner = (void*)(this_obj & (~1));
12855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12856 Pong_free(this_obj_conv);
12859 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12860 LDKPong this_ptr_conv;
12861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12862 this_ptr_conv.is_owned = false;
12863 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
12867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12868 LDKPong this_ptr_conv;
12869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12870 this_ptr_conv.is_owned = false;
12871 Pong_set_byteslen(&this_ptr_conv, val);
12874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
12875 LDKPong ret_var = Pong_new(byteslen_arg);
12876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12878 long ret_ref = (long)ret_var.inner;
12879 if (ret_var.is_owned) {
12885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12887 orig_conv.inner = (void*)(orig & (~1));
12888 orig_conv.is_owned = false;
12889 LDKPong ret_var = Pong_clone(&orig_conv);
12890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12892 long ret_ref = (long)ret_var.inner;
12893 if (ret_var.is_owned) {
12899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12900 LDKOpenChannel this_obj_conv;
12901 this_obj_conv.inner = (void*)(this_obj & (~1));
12902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12903 OpenChannel_free(this_obj_conv);
12906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12907 LDKOpenChannel this_ptr_conv;
12908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12909 this_ptr_conv.is_owned = false;
12910 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
12915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12916 LDKOpenChannel this_ptr_conv;
12917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12918 this_ptr_conv.is_owned = false;
12919 LDKThirtyTwoBytes val_ref;
12920 CHECK((*env)->GetArrayLength(env, val) == 32);
12921 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12922 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
12925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12926 LDKOpenChannel this_ptr_conv;
12927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12928 this_ptr_conv.is_owned = false;
12929 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
12934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12935 LDKOpenChannel this_ptr_conv;
12936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12937 this_ptr_conv.is_owned = false;
12938 LDKThirtyTwoBytes val_ref;
12939 CHECK((*env)->GetArrayLength(env, val) == 32);
12940 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12941 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12945 LDKOpenChannel this_ptr_conv;
12946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12947 this_ptr_conv.is_owned = false;
12948 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12953 LDKOpenChannel this_ptr_conv;
12954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12955 this_ptr_conv.is_owned = false;
12956 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12960 LDKOpenChannel this_ptr_conv;
12961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12962 this_ptr_conv.is_owned = false;
12963 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12968 LDKOpenChannel this_ptr_conv;
12969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12970 this_ptr_conv.is_owned = false;
12971 OpenChannel_set_push_msat(&this_ptr_conv, val);
12974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12975 LDKOpenChannel this_ptr_conv;
12976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12977 this_ptr_conv.is_owned = false;
12978 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12983 LDKOpenChannel this_ptr_conv;
12984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12985 this_ptr_conv.is_owned = false;
12986 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12989 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) {
12990 LDKOpenChannel this_ptr_conv;
12991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12992 this_ptr_conv.is_owned = false;
12993 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12997 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) {
12998 LDKOpenChannel this_ptr_conv;
12999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13000 this_ptr_conv.is_owned = false;
13001 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13005 LDKOpenChannel this_ptr_conv;
13006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13007 this_ptr_conv.is_owned = false;
13008 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
13012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13013 LDKOpenChannel this_ptr_conv;
13014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13015 this_ptr_conv.is_owned = false;
13016 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
13019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13020 LDKOpenChannel this_ptr_conv;
13021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13022 this_ptr_conv.is_owned = false;
13023 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
13027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13028 LDKOpenChannel this_ptr_conv;
13029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13030 this_ptr_conv.is_owned = false;
13031 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
13034 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
13035 LDKOpenChannel this_ptr_conv;
13036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13037 this_ptr_conv.is_owned = false;
13038 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
13042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13043 LDKOpenChannel this_ptr_conv;
13044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13045 this_ptr_conv.is_owned = false;
13046 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
13049 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13050 LDKOpenChannel this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = false;
13053 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
13057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13058 LDKOpenChannel this_ptr_conv;
13059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13060 this_ptr_conv.is_owned = false;
13061 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
13064 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13065 LDKOpenChannel this_ptr_conv;
13066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13067 this_ptr_conv.is_owned = false;
13068 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
13072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13073 LDKOpenChannel this_ptr_conv;
13074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13075 this_ptr_conv.is_owned = false;
13076 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13080 LDKOpenChannel this_ptr_conv;
13081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13082 this_ptr_conv.is_owned = false;
13083 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13084 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13089 LDKOpenChannel this_ptr_conv;
13090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13091 this_ptr_conv.is_owned = false;
13092 LDKPublicKey val_ref;
13093 CHECK((*env)->GetArrayLength(env, val) == 33);
13094 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13095 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13099 LDKOpenChannel this_ptr_conv;
13100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13101 this_ptr_conv.is_owned = false;
13102 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13103 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13108 LDKOpenChannel this_ptr_conv;
13109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13110 this_ptr_conv.is_owned = false;
13111 LDKPublicKey val_ref;
13112 CHECK((*env)->GetArrayLength(env, val) == 33);
13113 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13114 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13118 LDKOpenChannel this_ptr_conv;
13119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13120 this_ptr_conv.is_owned = false;
13121 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13122 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
13126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13127 LDKOpenChannel this_ptr_conv;
13128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13129 this_ptr_conv.is_owned = false;
13130 LDKPublicKey val_ref;
13131 CHECK((*env)->GetArrayLength(env, val) == 33);
13132 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13133 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
13136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13137 LDKOpenChannel this_ptr_conv;
13138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13139 this_ptr_conv.is_owned = false;
13140 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13141 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13146 LDKOpenChannel this_ptr_conv;
13147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13148 this_ptr_conv.is_owned = false;
13149 LDKPublicKey val_ref;
13150 CHECK((*env)->GetArrayLength(env, val) == 33);
13151 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13152 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13156 LDKOpenChannel this_ptr_conv;
13157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13158 this_ptr_conv.is_owned = false;
13159 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13160 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13165 LDKOpenChannel this_ptr_conv;
13166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13167 this_ptr_conv.is_owned = false;
13168 LDKPublicKey val_ref;
13169 CHECK((*env)->GetArrayLength(env, val) == 33);
13170 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13171 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13175 LDKOpenChannel this_ptr_conv;
13176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13177 this_ptr_conv.is_owned = false;
13178 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13183 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) {
13184 LDKOpenChannel this_ptr_conv;
13185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13186 this_ptr_conv.is_owned = false;
13187 LDKPublicKey val_ref;
13188 CHECK((*env)->GetArrayLength(env, val) == 33);
13189 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13190 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13193 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
13194 LDKOpenChannel this_ptr_conv;
13195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13196 this_ptr_conv.is_owned = false;
13197 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
13201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
13202 LDKOpenChannel this_ptr_conv;
13203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13204 this_ptr_conv.is_owned = false;
13205 OpenChannel_set_channel_flags(&this_ptr_conv, val);
13208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13209 LDKOpenChannel orig_conv;
13210 orig_conv.inner = (void*)(orig & (~1));
13211 orig_conv.is_owned = false;
13212 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
13213 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13214 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13215 long ret_ref = (long)ret_var.inner;
13216 if (ret_var.is_owned) {
13222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13223 LDKAcceptChannel this_obj_conv;
13224 this_obj_conv.inner = (void*)(this_obj & (~1));
13225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13226 AcceptChannel_free(this_obj_conv);
13229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13230 LDKAcceptChannel this_ptr_conv;
13231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13232 this_ptr_conv.is_owned = false;
13233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13239 LDKAcceptChannel this_ptr_conv;
13240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13241 this_ptr_conv.is_owned = false;
13242 LDKThirtyTwoBytes val_ref;
13243 CHECK((*env)->GetArrayLength(env, val) == 32);
13244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13245 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
13248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13249 LDKAcceptChannel this_ptr_conv;
13250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13251 this_ptr_conv.is_owned = false;
13252 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
13256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13257 LDKAcceptChannel this_ptr_conv;
13258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13259 this_ptr_conv.is_owned = false;
13260 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
13263 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) {
13264 LDKAcceptChannel this_ptr_conv;
13265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13266 this_ptr_conv.is_owned = false;
13267 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
13271 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) {
13272 LDKAcceptChannel this_ptr_conv;
13273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13274 this_ptr_conv.is_owned = false;
13275 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13279 LDKAcceptChannel this_ptr_conv;
13280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13281 this_ptr_conv.is_owned = false;
13282 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
13286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13287 LDKAcceptChannel this_ptr_conv;
13288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13289 this_ptr_conv.is_owned = false;
13290 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
13293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13294 LDKAcceptChannel this_ptr_conv;
13295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13296 this_ptr_conv.is_owned = false;
13297 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
13301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13302 LDKAcceptChannel this_ptr_conv;
13303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13304 this_ptr_conv.is_owned = false;
13305 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
13308 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13309 LDKAcceptChannel this_ptr_conv;
13310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13311 this_ptr_conv.is_owned = false;
13312 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
13316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13317 LDKAcceptChannel this_ptr_conv;
13318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13319 this_ptr_conv.is_owned = false;
13320 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
13323 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13324 LDKAcceptChannel this_ptr_conv;
13325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13326 this_ptr_conv.is_owned = false;
13327 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
13331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13332 LDKAcceptChannel this_ptr_conv;
13333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13334 this_ptr_conv.is_owned = false;
13335 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
13338 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13339 LDKAcceptChannel this_ptr_conv;
13340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13341 this_ptr_conv.is_owned = false;
13342 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
13346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13347 LDKAcceptChannel this_ptr_conv;
13348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13349 this_ptr_conv.is_owned = false;
13350 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13354 LDKAcceptChannel this_ptr_conv;
13355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13356 this_ptr_conv.is_owned = false;
13357 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13358 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13363 LDKAcceptChannel this_ptr_conv;
13364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13365 this_ptr_conv.is_owned = false;
13366 LDKPublicKey val_ref;
13367 CHECK((*env)->GetArrayLength(env, val) == 33);
13368 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13369 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13373 LDKAcceptChannel this_ptr_conv;
13374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13375 this_ptr_conv.is_owned = false;
13376 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13377 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13382 LDKAcceptChannel this_ptr_conv;
13383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13384 this_ptr_conv.is_owned = false;
13385 LDKPublicKey val_ref;
13386 CHECK((*env)->GetArrayLength(env, val) == 33);
13387 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13388 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13392 LDKAcceptChannel this_ptr_conv;
13393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13394 this_ptr_conv.is_owned = false;
13395 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13396 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
13400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13401 LDKAcceptChannel this_ptr_conv;
13402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13403 this_ptr_conv.is_owned = false;
13404 LDKPublicKey val_ref;
13405 CHECK((*env)->GetArrayLength(env, val) == 33);
13406 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13407 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
13410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13411 LDKAcceptChannel this_ptr_conv;
13412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13413 this_ptr_conv.is_owned = false;
13414 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13415 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13420 LDKAcceptChannel this_ptr_conv;
13421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13422 this_ptr_conv.is_owned = false;
13423 LDKPublicKey val_ref;
13424 CHECK((*env)->GetArrayLength(env, val) == 33);
13425 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13426 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13430 LDKAcceptChannel this_ptr_conv;
13431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13432 this_ptr_conv.is_owned = false;
13433 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13439 LDKAcceptChannel this_ptr_conv;
13440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13441 this_ptr_conv.is_owned = false;
13442 LDKPublicKey val_ref;
13443 CHECK((*env)->GetArrayLength(env, val) == 33);
13444 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13445 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13449 LDKAcceptChannel this_ptr_conv;
13450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13451 this_ptr_conv.is_owned = false;
13452 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13457 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) {
13458 LDKAcceptChannel this_ptr_conv;
13459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13460 this_ptr_conv.is_owned = false;
13461 LDKPublicKey val_ref;
13462 CHECK((*env)->GetArrayLength(env, val) == 33);
13463 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13464 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13468 LDKAcceptChannel orig_conv;
13469 orig_conv.inner = (void*)(orig & (~1));
13470 orig_conv.is_owned = false;
13471 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13472 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13473 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13474 long ret_ref = (long)ret_var.inner;
13475 if (ret_var.is_owned) {
13481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13482 LDKFundingCreated this_obj_conv;
13483 this_obj_conv.inner = (void*)(this_obj & (~1));
13484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13485 FundingCreated_free(this_obj_conv);
13488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13489 LDKFundingCreated this_ptr_conv;
13490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13491 this_ptr_conv.is_owned = false;
13492 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13493 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
13497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13498 LDKFundingCreated this_ptr_conv;
13499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13500 this_ptr_conv.is_owned = false;
13501 LDKThirtyTwoBytes val_ref;
13502 CHECK((*env)->GetArrayLength(env, val) == 32);
13503 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13504 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
13508 LDKFundingCreated this_ptr_conv;
13509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13510 this_ptr_conv.is_owned = false;
13511 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13512 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
13516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13517 LDKFundingCreated this_ptr_conv;
13518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13519 this_ptr_conv.is_owned = false;
13520 LDKThirtyTwoBytes val_ref;
13521 CHECK((*env)->GetArrayLength(env, val) == 32);
13522 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13523 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13526 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
13527 LDKFundingCreated this_ptr_conv;
13528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13529 this_ptr_conv.is_owned = false;
13530 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13535 LDKFundingCreated this_ptr_conv;
13536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13537 this_ptr_conv.is_owned = false;
13538 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13542 LDKFundingCreated this_ptr_conv;
13543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13544 this_ptr_conv.is_owned = false;
13545 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
13550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13551 LDKFundingCreated this_ptr_conv;
13552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13553 this_ptr_conv.is_owned = false;
13554 LDKSignature val_ref;
13555 CHECK((*env)->GetArrayLength(env, val) == 64);
13556 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13557 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13560 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) {
13561 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13562 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
13563 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
13564 LDKThirtyTwoBytes funding_txid_arg_ref;
13565 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
13566 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
13567 LDKSignature signature_arg_ref;
13568 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13569 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13570 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
13571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13573 long ret_ref = (long)ret_var.inner;
13574 if (ret_var.is_owned) {
13580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13581 LDKFundingCreated orig_conv;
13582 orig_conv.inner = (void*)(orig & (~1));
13583 orig_conv.is_owned = false;
13584 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13587 long ret_ref = (long)ret_var.inner;
13588 if (ret_var.is_owned) {
13594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13595 LDKFundingSigned this_obj_conv;
13596 this_obj_conv.inner = (void*)(this_obj & (~1));
13597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13598 FundingSigned_free(this_obj_conv);
13601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13602 LDKFundingSigned this_ptr_conv;
13603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13604 this_ptr_conv.is_owned = false;
13605 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13606 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
13610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13611 LDKFundingSigned this_ptr_conv;
13612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13613 this_ptr_conv.is_owned = false;
13614 LDKThirtyTwoBytes val_ref;
13615 CHECK((*env)->GetArrayLength(env, val) == 32);
13616 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13617 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13621 LDKFundingSigned this_ptr_conv;
13622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13623 this_ptr_conv.is_owned = false;
13624 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
13629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13630 LDKFundingSigned this_ptr_conv;
13631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13632 this_ptr_conv.is_owned = false;
13633 LDKSignature val_ref;
13634 CHECK((*env)->GetArrayLength(env, val) == 64);
13635 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13636 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
13640 LDKThirtyTwoBytes channel_id_arg_ref;
13641 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13642 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13643 LDKSignature signature_arg_ref;
13644 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13645 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13646 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13647 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13648 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13649 long ret_ref = (long)ret_var.inner;
13650 if (ret_var.is_owned) {
13656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13657 LDKFundingSigned orig_conv;
13658 orig_conv.inner = (void*)(orig & (~1));
13659 orig_conv.is_owned = false;
13660 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13663 long ret_ref = (long)ret_var.inner;
13664 if (ret_var.is_owned) {
13670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13671 LDKFundingLocked this_obj_conv;
13672 this_obj_conv.inner = (void*)(this_obj & (~1));
13673 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13674 FundingLocked_free(this_obj_conv);
13677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13678 LDKFundingLocked this_ptr_conv;
13679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13680 this_ptr_conv.is_owned = false;
13681 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13682 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
13686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13687 LDKFundingLocked this_ptr_conv;
13688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13689 this_ptr_conv.is_owned = false;
13690 LDKThirtyTwoBytes val_ref;
13691 CHECK((*env)->GetArrayLength(env, val) == 32);
13692 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13693 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
13696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13697 LDKFundingLocked this_ptr_conv;
13698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13699 this_ptr_conv.is_owned = false;
13700 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13701 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
13705 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) {
13706 LDKFundingLocked this_ptr_conv;
13707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13708 this_ptr_conv.is_owned = false;
13709 LDKPublicKey val_ref;
13710 CHECK((*env)->GetArrayLength(env, val) == 33);
13711 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13712 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13715 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) {
13716 LDKThirtyTwoBytes channel_id_arg_ref;
13717 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13718 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13719 LDKPublicKey next_per_commitment_point_arg_ref;
13720 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
13721 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
13722 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
13723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13725 long ret_ref = (long)ret_var.inner;
13726 if (ret_var.is_owned) {
13732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13733 LDKFundingLocked orig_conv;
13734 orig_conv.inner = (void*)(orig & (~1));
13735 orig_conv.is_owned = false;
13736 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
13737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13739 long ret_ref = (long)ret_var.inner;
13740 if (ret_var.is_owned) {
13746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13747 LDKShutdown this_obj_conv;
13748 this_obj_conv.inner = (void*)(this_obj & (~1));
13749 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13750 Shutdown_free(this_obj_conv);
13753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13754 LDKShutdown this_ptr_conv;
13755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13756 this_ptr_conv.is_owned = false;
13757 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13758 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
13762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13763 LDKShutdown this_ptr_conv;
13764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13765 this_ptr_conv.is_owned = false;
13766 LDKThirtyTwoBytes val_ref;
13767 CHECK((*env)->GetArrayLength(env, val) == 32);
13768 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13769 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
13772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13773 LDKShutdown this_ptr_conv;
13774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13775 this_ptr_conv.is_owned = false;
13776 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
13777 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13778 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13783 LDKShutdown this_ptr_conv;
13784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13785 this_ptr_conv.is_owned = false;
13786 LDKCVec_u8Z val_ref;
13787 val_ref.datalen = (*env)->GetArrayLength(env, val);
13788 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13789 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13790 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
13793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
13794 LDKThirtyTwoBytes channel_id_arg_ref;
13795 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13796 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13797 LDKCVec_u8Z scriptpubkey_arg_ref;
13798 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
13799 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13800 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
13801 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
13802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13804 long ret_ref = (long)ret_var.inner;
13805 if (ret_var.is_owned) {
13811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13812 LDKShutdown orig_conv;
13813 orig_conv.inner = (void*)(orig & (~1));
13814 orig_conv.is_owned = false;
13815 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
13816 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13817 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13818 long ret_ref = (long)ret_var.inner;
13819 if (ret_var.is_owned) {
13825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13826 LDKClosingSigned this_obj_conv;
13827 this_obj_conv.inner = (void*)(this_obj & (~1));
13828 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13829 ClosingSigned_free(this_obj_conv);
13832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13833 LDKClosingSigned this_ptr_conv;
13834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13835 this_ptr_conv.is_owned = false;
13836 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13837 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
13841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13842 LDKClosingSigned this_ptr_conv;
13843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13844 this_ptr_conv.is_owned = false;
13845 LDKThirtyTwoBytes val_ref;
13846 CHECK((*env)->GetArrayLength(env, val) == 32);
13847 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13848 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
13851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13852 LDKClosingSigned this_ptr_conv;
13853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13854 this_ptr_conv.is_owned = false;
13855 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
13859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13860 LDKClosingSigned this_ptr_conv;
13861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13862 this_ptr_conv.is_owned = false;
13863 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
13866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13867 LDKClosingSigned this_ptr_conv;
13868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13869 this_ptr_conv.is_owned = false;
13870 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13871 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
13875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13876 LDKClosingSigned this_ptr_conv;
13877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13878 this_ptr_conv.is_owned = false;
13879 LDKSignature val_ref;
13880 CHECK((*env)->GetArrayLength(env, val) == 64);
13881 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13882 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
13885 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) {
13886 LDKThirtyTwoBytes channel_id_arg_ref;
13887 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13888 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13889 LDKSignature signature_arg_ref;
13890 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13891 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13892 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
13893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13895 long ret_ref = (long)ret_var.inner;
13896 if (ret_var.is_owned) {
13902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13903 LDKClosingSigned orig_conv;
13904 orig_conv.inner = (void*)(orig & (~1));
13905 orig_conv.is_owned = false;
13906 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
13907 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13908 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13909 long ret_ref = (long)ret_var.inner;
13910 if (ret_var.is_owned) {
13916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13917 LDKUpdateAddHTLC this_obj_conv;
13918 this_obj_conv.inner = (void*)(this_obj & (~1));
13919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13920 UpdateAddHTLC_free(this_obj_conv);
13923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13924 LDKUpdateAddHTLC this_ptr_conv;
13925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13926 this_ptr_conv.is_owned = false;
13927 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13928 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
13932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13933 LDKUpdateAddHTLC this_ptr_conv;
13934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13935 this_ptr_conv.is_owned = false;
13936 LDKThirtyTwoBytes val_ref;
13937 CHECK((*env)->GetArrayLength(env, val) == 32);
13938 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13939 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
13942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13943 LDKUpdateAddHTLC this_ptr_conv;
13944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13945 this_ptr_conv.is_owned = false;
13946 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13951 LDKUpdateAddHTLC this_ptr_conv;
13952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13953 this_ptr_conv.is_owned = false;
13954 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13958 LDKUpdateAddHTLC this_ptr_conv;
13959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13960 this_ptr_conv.is_owned = false;
13961 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13966 LDKUpdateAddHTLC this_ptr_conv;
13967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13968 this_ptr_conv.is_owned = false;
13969 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13973 LDKUpdateAddHTLC this_ptr_conv;
13974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13975 this_ptr_conv.is_owned = false;
13976 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13977 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
13981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13982 LDKUpdateAddHTLC this_ptr_conv;
13983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13984 this_ptr_conv.is_owned = false;
13985 LDKThirtyTwoBytes val_ref;
13986 CHECK((*env)->GetArrayLength(env, val) == 32);
13987 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13988 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13991 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
13992 LDKUpdateAddHTLC this_ptr_conv;
13993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13994 this_ptr_conv.is_owned = false;
13995 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14000 LDKUpdateAddHTLC this_ptr_conv;
14001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14002 this_ptr_conv.is_owned = false;
14003 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
14006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14007 LDKUpdateAddHTLC orig_conv;
14008 orig_conv.inner = (void*)(orig & (~1));
14009 orig_conv.is_owned = false;
14010 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
14011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14013 long ret_ref = (long)ret_var.inner;
14014 if (ret_var.is_owned) {
14020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14021 LDKUpdateFulfillHTLC this_obj_conv;
14022 this_obj_conv.inner = (void*)(this_obj & (~1));
14023 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14024 UpdateFulfillHTLC_free(this_obj_conv);
14027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14028 LDKUpdateFulfillHTLC this_ptr_conv;
14029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14030 this_ptr_conv.is_owned = false;
14031 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
14036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14037 LDKUpdateFulfillHTLC this_ptr_conv;
14038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14039 this_ptr_conv.is_owned = false;
14040 LDKThirtyTwoBytes val_ref;
14041 CHECK((*env)->GetArrayLength(env, val) == 32);
14042 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14043 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
14046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14047 LDKUpdateFulfillHTLC this_ptr_conv;
14048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14049 this_ptr_conv.is_owned = false;
14050 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
14054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14055 LDKUpdateFulfillHTLC this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = false;
14058 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
14061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
14062 LDKUpdateFulfillHTLC this_ptr_conv;
14063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14064 this_ptr_conv.is_owned = false;
14065 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
14070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14071 LDKUpdateFulfillHTLC this_ptr_conv;
14072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14073 this_ptr_conv.is_owned = false;
14074 LDKThirtyTwoBytes val_ref;
14075 CHECK((*env)->GetArrayLength(env, val) == 32);
14076 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14077 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
14080 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) {
14081 LDKThirtyTwoBytes channel_id_arg_ref;
14082 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14083 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14084 LDKThirtyTwoBytes payment_preimage_arg_ref;
14085 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
14086 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
14087 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
14088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14090 long ret_ref = (long)ret_var.inner;
14091 if (ret_var.is_owned) {
14097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14098 LDKUpdateFulfillHTLC orig_conv;
14099 orig_conv.inner = (void*)(orig & (~1));
14100 orig_conv.is_owned = false;
14101 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
14102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14104 long ret_ref = (long)ret_var.inner;
14105 if (ret_var.is_owned) {
14111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14112 LDKUpdateFailHTLC this_obj_conv;
14113 this_obj_conv.inner = (void*)(this_obj & (~1));
14114 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14115 UpdateFailHTLC_free(this_obj_conv);
14118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14119 LDKUpdateFailHTLC this_ptr_conv;
14120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14121 this_ptr_conv.is_owned = false;
14122 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
14127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14128 LDKUpdateFailHTLC this_ptr_conv;
14129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14130 this_ptr_conv.is_owned = false;
14131 LDKThirtyTwoBytes val_ref;
14132 CHECK((*env)->GetArrayLength(env, val) == 32);
14133 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14134 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
14137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14138 LDKUpdateFailHTLC this_ptr_conv;
14139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14140 this_ptr_conv.is_owned = false;
14141 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
14145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14146 LDKUpdateFailHTLC this_ptr_conv;
14147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14148 this_ptr_conv.is_owned = false;
14149 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
14152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14153 LDKUpdateFailHTLC orig_conv;
14154 orig_conv.inner = (void*)(orig & (~1));
14155 orig_conv.is_owned = false;
14156 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
14157 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14158 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14159 long ret_ref = (long)ret_var.inner;
14160 if (ret_var.is_owned) {
14166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14167 LDKUpdateFailMalformedHTLC this_obj_conv;
14168 this_obj_conv.inner = (void*)(this_obj & (~1));
14169 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14170 UpdateFailMalformedHTLC_free(this_obj_conv);
14173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14174 LDKUpdateFailMalformedHTLC this_ptr_conv;
14175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14176 this_ptr_conv.is_owned = false;
14177 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
14182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14183 LDKUpdateFailMalformedHTLC this_ptr_conv;
14184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14185 this_ptr_conv.is_owned = false;
14186 LDKThirtyTwoBytes val_ref;
14187 CHECK((*env)->GetArrayLength(env, val) == 32);
14188 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14189 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
14192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14193 LDKUpdateFailMalformedHTLC this_ptr_conv;
14194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14195 this_ptr_conv.is_owned = false;
14196 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
14200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14201 LDKUpdateFailMalformedHTLC this_ptr_conv;
14202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14203 this_ptr_conv.is_owned = false;
14204 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
14207 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
14208 LDKUpdateFailMalformedHTLC this_ptr_conv;
14209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14210 this_ptr_conv.is_owned = false;
14211 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
14215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14216 LDKUpdateFailMalformedHTLC this_ptr_conv;
14217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14218 this_ptr_conv.is_owned = false;
14219 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
14222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14223 LDKUpdateFailMalformedHTLC orig_conv;
14224 orig_conv.inner = (void*)(orig & (~1));
14225 orig_conv.is_owned = false;
14226 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
14227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14229 long ret_ref = (long)ret_var.inner;
14230 if (ret_var.is_owned) {
14236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14237 LDKCommitmentSigned this_obj_conv;
14238 this_obj_conv.inner = (void*)(this_obj & (~1));
14239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14240 CommitmentSigned_free(this_obj_conv);
14243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14244 LDKCommitmentSigned this_ptr_conv;
14245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14246 this_ptr_conv.is_owned = false;
14247 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14248 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
14252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14253 LDKCommitmentSigned this_ptr_conv;
14254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14255 this_ptr_conv.is_owned = false;
14256 LDKThirtyTwoBytes val_ref;
14257 CHECK((*env)->GetArrayLength(env, val) == 32);
14258 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14259 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
14262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14263 LDKCommitmentSigned this_ptr_conv;
14264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14265 this_ptr_conv.is_owned = false;
14266 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14267 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
14271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14272 LDKCommitmentSigned this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = false;
14275 LDKSignature val_ref;
14276 CHECK((*env)->GetArrayLength(env, val) == 64);
14277 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14278 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
14281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
14282 LDKCommitmentSigned this_ptr_conv;
14283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14284 this_ptr_conv.is_owned = false;
14285 LDKCVec_SignatureZ val_constr;
14286 val_constr.datalen = (*env)->GetArrayLength(env, val);
14287 if (val_constr.datalen > 0)
14288 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14290 val_constr.data = NULL;
14291 for (size_t i = 0; i < val_constr.datalen; i++) {
14292 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
14293 LDKSignature val_conv_8_ref;
14294 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
14295 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
14296 val_constr.data[i] = val_conv_8_ref;
14298 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
14301 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) {
14302 LDKThirtyTwoBytes channel_id_arg_ref;
14303 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14304 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14305 LDKSignature signature_arg_ref;
14306 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14307 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14308 LDKCVec_SignatureZ htlc_signatures_arg_constr;
14309 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
14310 if (htlc_signatures_arg_constr.datalen > 0)
14311 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14313 htlc_signatures_arg_constr.data = NULL;
14314 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
14315 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
14316 LDKSignature htlc_signatures_arg_conv_8_ref;
14317 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
14318 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
14319 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
14321 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
14322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14324 long ret_ref = (long)ret_var.inner;
14325 if (ret_var.is_owned) {
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14332 LDKCommitmentSigned orig_conv;
14333 orig_conv.inner = (void*)(orig & (~1));
14334 orig_conv.is_owned = false;
14335 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
14336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14338 long ret_ref = (long)ret_var.inner;
14339 if (ret_var.is_owned) {
14345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14346 LDKRevokeAndACK this_obj_conv;
14347 this_obj_conv.inner = (void*)(this_obj & (~1));
14348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14349 RevokeAndACK_free(this_obj_conv);
14352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14353 LDKRevokeAndACK this_ptr_conv;
14354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14355 this_ptr_conv.is_owned = false;
14356 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14357 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
14361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14362 LDKRevokeAndACK this_ptr_conv;
14363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14364 this_ptr_conv.is_owned = false;
14365 LDKThirtyTwoBytes val_ref;
14366 CHECK((*env)->GetArrayLength(env, val) == 32);
14367 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14368 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
14371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14372 LDKRevokeAndACK this_ptr_conv;
14373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14374 this_ptr_conv.is_owned = false;
14375 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
14380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14381 LDKRevokeAndACK this_ptr_conv;
14382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14383 this_ptr_conv.is_owned = false;
14384 LDKThirtyTwoBytes val_ref;
14385 CHECK((*env)->GetArrayLength(env, val) == 32);
14386 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14387 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
14390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14391 LDKRevokeAndACK this_ptr_conv;
14392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14393 this_ptr_conv.is_owned = false;
14394 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14395 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
14399 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) {
14400 LDKRevokeAndACK this_ptr_conv;
14401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14402 this_ptr_conv.is_owned = false;
14403 LDKPublicKey val_ref;
14404 CHECK((*env)->GetArrayLength(env, val) == 33);
14405 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14406 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
14409 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) {
14410 LDKThirtyTwoBytes channel_id_arg_ref;
14411 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14412 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14413 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
14414 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
14415 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
14416 LDKPublicKey next_per_commitment_point_arg_ref;
14417 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
14418 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
14419 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
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 int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14430 LDKRevokeAndACK orig_conv;
14431 orig_conv.inner = (void*)(orig & (~1));
14432 orig_conv.is_owned = false;
14433 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
14434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14436 long ret_ref = (long)ret_var.inner;
14437 if (ret_var.is_owned) {
14443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14444 LDKUpdateFee this_obj_conv;
14445 this_obj_conv.inner = (void*)(this_obj & (~1));
14446 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14447 UpdateFee_free(this_obj_conv);
14450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14451 LDKUpdateFee this_ptr_conv;
14452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14453 this_ptr_conv.is_owned = false;
14454 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14455 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
14459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14460 LDKUpdateFee this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 LDKThirtyTwoBytes val_ref;
14464 CHECK((*env)->GetArrayLength(env, val) == 32);
14465 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14466 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14469 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
14470 LDKUpdateFee this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14478 LDKUpdateFee this_ptr_conv;
14479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14480 this_ptr_conv.is_owned = false;
14481 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14484 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) {
14485 LDKThirtyTwoBytes channel_id_arg_ref;
14486 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14487 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14488 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14489 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14490 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14491 long ret_ref = (long)ret_var.inner;
14492 if (ret_var.is_owned) {
14498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14499 LDKUpdateFee orig_conv;
14500 orig_conv.inner = (void*)(orig & (~1));
14501 orig_conv.is_owned = false;
14502 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14505 long ret_ref = (long)ret_var.inner;
14506 if (ret_var.is_owned) {
14512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14513 LDKDataLossProtect this_obj_conv;
14514 this_obj_conv.inner = (void*)(this_obj & (~1));
14515 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14516 DataLossProtect_free(this_obj_conv);
14519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14520 LDKDataLossProtect this_ptr_conv;
14521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14522 this_ptr_conv.is_owned = false;
14523 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14524 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
14528 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) {
14529 LDKDataLossProtect this_ptr_conv;
14530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14531 this_ptr_conv.is_owned = false;
14532 LDKThirtyTwoBytes val_ref;
14533 CHECK((*env)->GetArrayLength(env, val) == 32);
14534 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14535 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14539 LDKDataLossProtect this_ptr_conv;
14540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14541 this_ptr_conv.is_owned = false;
14542 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14543 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
14547 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) {
14548 LDKDataLossProtect this_ptr_conv;
14549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14550 this_ptr_conv.is_owned = false;
14551 LDKPublicKey val_ref;
14552 CHECK((*env)->GetArrayLength(env, val) == 33);
14553 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14554 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14557 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) {
14558 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14559 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
14560 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
14561 LDKPublicKey my_current_per_commitment_point_arg_ref;
14562 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
14563 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
14564 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14567 long ret_ref = (long)ret_var.inner;
14568 if (ret_var.is_owned) {
14574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14575 LDKDataLossProtect orig_conv;
14576 orig_conv.inner = (void*)(orig & (~1));
14577 orig_conv.is_owned = false;
14578 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14581 long ret_ref = (long)ret_var.inner;
14582 if (ret_var.is_owned) {
14588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14589 LDKChannelReestablish this_obj_conv;
14590 this_obj_conv.inner = (void*)(this_obj & (~1));
14591 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14592 ChannelReestablish_free(this_obj_conv);
14595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14596 LDKChannelReestablish this_ptr_conv;
14597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14598 this_ptr_conv.is_owned = false;
14599 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14600 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
14604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14605 LDKChannelReestablish this_ptr_conv;
14606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14607 this_ptr_conv.is_owned = false;
14608 LDKThirtyTwoBytes val_ref;
14609 CHECK((*env)->GetArrayLength(env, val) == 32);
14610 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14611 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14615 LDKChannelReestablish this_ptr_conv;
14616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14617 this_ptr_conv.is_owned = false;
14618 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14622 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) {
14623 LDKChannelReestablish this_ptr_conv;
14624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14625 this_ptr_conv.is_owned = false;
14626 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14630 LDKChannelReestablish this_ptr_conv;
14631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14632 this_ptr_conv.is_owned = false;
14633 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14637 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) {
14638 LDKChannelReestablish this_ptr_conv;
14639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14640 this_ptr_conv.is_owned = false;
14641 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14645 LDKChannelReestablish orig_conv;
14646 orig_conv.inner = (void*)(orig & (~1));
14647 orig_conv.is_owned = false;
14648 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14651 long ret_ref = (long)ret_var.inner;
14652 if (ret_var.is_owned) {
14658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14659 LDKAnnouncementSignatures this_obj_conv;
14660 this_obj_conv.inner = (void*)(this_obj & (~1));
14661 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14662 AnnouncementSignatures_free(this_obj_conv);
14665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14666 LDKAnnouncementSignatures this_ptr_conv;
14667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14668 this_ptr_conv.is_owned = false;
14669 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14670 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
14674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14675 LDKAnnouncementSignatures this_ptr_conv;
14676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14677 this_ptr_conv.is_owned = false;
14678 LDKThirtyTwoBytes val_ref;
14679 CHECK((*env)->GetArrayLength(env, val) == 32);
14680 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14681 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
14684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14685 LDKAnnouncementSignatures this_ptr_conv;
14686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14687 this_ptr_conv.is_owned = false;
14688 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
14692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14693 LDKAnnouncementSignatures this_ptr_conv;
14694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14695 this_ptr_conv.is_owned = false;
14696 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
14699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14700 LDKAnnouncementSignatures this_ptr_conv;
14701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14702 this_ptr_conv.is_owned = false;
14703 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14704 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
14708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14709 LDKAnnouncementSignatures this_ptr_conv;
14710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14711 this_ptr_conv.is_owned = false;
14712 LDKSignature val_ref;
14713 CHECK((*env)->GetArrayLength(env, val) == 64);
14714 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14715 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
14718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14719 LDKAnnouncementSignatures this_ptr_conv;
14720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14721 this_ptr_conv.is_owned = false;
14722 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14723 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
14727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14728 LDKAnnouncementSignatures this_ptr_conv;
14729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14730 this_ptr_conv.is_owned = false;
14731 LDKSignature val_ref;
14732 CHECK((*env)->GetArrayLength(env, val) == 64);
14733 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14734 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
14737 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) {
14738 LDKThirtyTwoBytes channel_id_arg_ref;
14739 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14740 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14741 LDKSignature node_signature_arg_ref;
14742 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
14743 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
14744 LDKSignature bitcoin_signature_arg_ref;
14745 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
14746 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
14747 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
14748 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14749 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14750 long ret_ref = (long)ret_var.inner;
14751 if (ret_var.is_owned) {
14757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14758 LDKAnnouncementSignatures orig_conv;
14759 orig_conv.inner = (void*)(orig & (~1));
14760 orig_conv.is_owned = false;
14761 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
14762 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14763 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14764 long ret_ref = (long)ret_var.inner;
14765 if (ret_var.is_owned) {
14771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14772 if ((this_ptr & 1) != 0) return;
14773 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
14774 FREE((void*)this_ptr);
14775 NetAddress_free(this_ptr_conv);
14778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14779 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
14780 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
14781 *ret_copy = NetAddress_clone(orig_conv);
14782 long ret_ref = (long)ret_copy;
14786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
14787 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
14788 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
14789 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14790 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14791 CVec_u8Z_free(ret_var);
14795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14796 LDKu8slice ser_ref;
14797 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14798 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14799 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14800 *ret_conv = Result_read(ser_ref);
14801 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14802 return (long)ret_conv;
14805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14806 LDKUnsignedNodeAnnouncement this_obj_conv;
14807 this_obj_conv.inner = (void*)(this_obj & (~1));
14808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14809 UnsignedNodeAnnouncement_free(this_obj_conv);
14812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
14813 LDKUnsignedNodeAnnouncement this_ptr_conv;
14814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14815 this_ptr_conv.is_owned = false;
14816 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
14817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14819 long ret_ref = (long)ret_var.inner;
14820 if (ret_var.is_owned) {
14826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14827 LDKUnsignedNodeAnnouncement this_ptr_conv;
14828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14829 this_ptr_conv.is_owned = false;
14830 LDKNodeFeatures val_conv;
14831 val_conv.inner = (void*)(val & (~1));
14832 val_conv.is_owned = (val & 1) || (val == 0);
14833 val_conv = NodeFeatures_clone(&val_conv);
14834 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
14837 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
14838 LDKUnsignedNodeAnnouncement this_ptr_conv;
14839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14840 this_ptr_conv.is_owned = false;
14841 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
14845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14846 LDKUnsignedNodeAnnouncement this_ptr_conv;
14847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14848 this_ptr_conv.is_owned = false;
14849 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
14852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14853 LDKUnsignedNodeAnnouncement this_ptr_conv;
14854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14855 this_ptr_conv.is_owned = false;
14856 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
14861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14862 LDKUnsignedNodeAnnouncement this_ptr_conv;
14863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14864 this_ptr_conv.is_owned = false;
14865 LDKPublicKey val_ref;
14866 CHECK((*env)->GetArrayLength(env, val) == 33);
14867 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14868 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
14871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
14872 LDKUnsignedNodeAnnouncement this_ptr_conv;
14873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14874 this_ptr_conv.is_owned = false;
14875 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
14876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
14880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14881 LDKUnsignedNodeAnnouncement this_ptr_conv;
14882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14883 this_ptr_conv.is_owned = false;
14884 LDKThreeBytes val_ref;
14885 CHECK((*env)->GetArrayLength(env, val) == 3);
14886 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
14887 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
14890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
14891 LDKUnsignedNodeAnnouncement this_ptr_conv;
14892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14893 this_ptr_conv.is_owned = false;
14894 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
14899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14900 LDKUnsignedNodeAnnouncement this_ptr_conv;
14901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14902 this_ptr_conv.is_owned = false;
14903 LDKThirtyTwoBytes val_ref;
14904 CHECK((*env)->GetArrayLength(env, val) == 32);
14905 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14906 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
14909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14910 LDKUnsignedNodeAnnouncement this_ptr_conv;
14911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14912 this_ptr_conv.is_owned = false;
14913 LDKCVec_NetAddressZ val_constr;
14914 val_constr.datalen = (*env)->GetArrayLength(env, val);
14915 if (val_constr.datalen > 0)
14916 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14918 val_constr.data = NULL;
14919 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14920 for (size_t m = 0; m < val_constr.datalen; m++) {
14921 int64_t val_conv_12 = val_vals[m];
14922 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
14923 FREE((void*)val_conv_12);
14924 val_constr.data[m] = val_conv_12_conv;
14926 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14927 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
14930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14931 LDKUnsignedNodeAnnouncement orig_conv;
14932 orig_conv.inner = (void*)(orig & (~1));
14933 orig_conv.is_owned = false;
14934 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
14935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14937 long ret_ref = (long)ret_var.inner;
14938 if (ret_var.is_owned) {
14944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14945 LDKNodeAnnouncement this_obj_conv;
14946 this_obj_conv.inner = (void*)(this_obj & (~1));
14947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14948 NodeAnnouncement_free(this_obj_conv);
14951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14952 LDKNodeAnnouncement this_ptr_conv;
14953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14954 this_ptr_conv.is_owned = false;
14955 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14956 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
14960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14961 LDKNodeAnnouncement this_ptr_conv;
14962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14963 this_ptr_conv.is_owned = false;
14964 LDKSignature val_ref;
14965 CHECK((*env)->GetArrayLength(env, val) == 64);
14966 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14967 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14971 LDKNodeAnnouncement this_ptr_conv;
14972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14973 this_ptr_conv.is_owned = false;
14974 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14975 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14976 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14977 long ret_ref = (long)ret_var.inner;
14978 if (ret_var.is_owned) {
14984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14985 LDKNodeAnnouncement this_ptr_conv;
14986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14987 this_ptr_conv.is_owned = false;
14988 LDKUnsignedNodeAnnouncement val_conv;
14989 val_conv.inner = (void*)(val & (~1));
14990 val_conv.is_owned = (val & 1) || (val == 0);
14991 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14992 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
14996 LDKSignature signature_arg_ref;
14997 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14998 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14999 LDKUnsignedNodeAnnouncement contents_arg_conv;
15000 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15001 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15002 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
15003 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
15004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15006 long ret_ref = (long)ret_var.inner;
15007 if (ret_var.is_owned) {
15013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15014 LDKNodeAnnouncement orig_conv;
15015 orig_conv.inner = (void*)(orig & (~1));
15016 orig_conv.is_owned = false;
15017 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
15018 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15019 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15020 long ret_ref = (long)ret_var.inner;
15021 if (ret_var.is_owned) {
15027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15028 LDKUnsignedChannelAnnouncement this_obj_conv;
15029 this_obj_conv.inner = (void*)(this_obj & (~1));
15030 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15031 UnsignedChannelAnnouncement_free(this_obj_conv);
15034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15035 LDKUnsignedChannelAnnouncement this_ptr_conv;
15036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15037 this_ptr_conv.is_owned = false;
15038 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
15039 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15040 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15041 long ret_ref = (long)ret_var.inner;
15042 if (ret_var.is_owned) {
15048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15049 LDKUnsignedChannelAnnouncement this_ptr_conv;
15050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15051 this_ptr_conv.is_owned = false;
15052 LDKChannelFeatures val_conv;
15053 val_conv.inner = (void*)(val & (~1));
15054 val_conv.is_owned = (val & 1) || (val == 0);
15055 val_conv = ChannelFeatures_clone(&val_conv);
15056 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
15059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15060 LDKUnsignedChannelAnnouncement this_ptr_conv;
15061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15062 this_ptr_conv.is_owned = false;
15063 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15064 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
15068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15069 LDKUnsignedChannelAnnouncement this_ptr_conv;
15070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15071 this_ptr_conv.is_owned = false;
15072 LDKThirtyTwoBytes val_ref;
15073 CHECK((*env)->GetArrayLength(env, val) == 32);
15074 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15075 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
15078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15079 LDKUnsignedChannelAnnouncement this_ptr_conv;
15080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15081 this_ptr_conv.is_owned = false;
15082 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
15086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15087 LDKUnsignedChannelAnnouncement this_ptr_conv;
15088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15089 this_ptr_conv.is_owned = false;
15090 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
15093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15094 LDKUnsignedChannelAnnouncement this_ptr_conv;
15095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15096 this_ptr_conv.is_owned = false;
15097 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
15102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15103 LDKUnsignedChannelAnnouncement this_ptr_conv;
15104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15105 this_ptr_conv.is_owned = false;
15106 LDKPublicKey val_ref;
15107 CHECK((*env)->GetArrayLength(env, val) == 33);
15108 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15109 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
15112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15113 LDKUnsignedChannelAnnouncement this_ptr_conv;
15114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15115 this_ptr_conv.is_owned = false;
15116 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15117 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
15121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15122 LDKUnsignedChannelAnnouncement this_ptr_conv;
15123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15124 this_ptr_conv.is_owned = false;
15125 LDKPublicKey val_ref;
15126 CHECK((*env)->GetArrayLength(env, val) == 33);
15127 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15128 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
15131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15132 LDKUnsignedChannelAnnouncement this_ptr_conv;
15133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15134 this_ptr_conv.is_owned = false;
15135 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
15140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15141 LDKUnsignedChannelAnnouncement this_ptr_conv;
15142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15143 this_ptr_conv.is_owned = false;
15144 LDKPublicKey val_ref;
15145 CHECK((*env)->GetArrayLength(env, val) == 33);
15146 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15147 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
15150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15151 LDKUnsignedChannelAnnouncement this_ptr_conv;
15152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15153 this_ptr_conv.is_owned = false;
15154 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15155 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
15159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15160 LDKUnsignedChannelAnnouncement this_ptr_conv;
15161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15162 this_ptr_conv.is_owned = false;
15163 LDKPublicKey val_ref;
15164 CHECK((*env)->GetArrayLength(env, val) == 33);
15165 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15166 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
15169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15170 LDKUnsignedChannelAnnouncement orig_conv;
15171 orig_conv.inner = (void*)(orig & (~1));
15172 orig_conv.is_owned = false;
15173 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
15174 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15175 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15176 long ret_ref = (long)ret_var.inner;
15177 if (ret_var.is_owned) {
15183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15184 LDKChannelAnnouncement this_obj_conv;
15185 this_obj_conv.inner = (void*)(this_obj & (~1));
15186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15187 ChannelAnnouncement_free(this_obj_conv);
15190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15191 LDKChannelAnnouncement this_ptr_conv;
15192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15193 this_ptr_conv.is_owned = false;
15194 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15195 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
15199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15200 LDKChannelAnnouncement this_ptr_conv;
15201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15202 this_ptr_conv.is_owned = false;
15203 LDKSignature val_ref;
15204 CHECK((*env)->GetArrayLength(env, val) == 64);
15205 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15206 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
15209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15210 LDKChannelAnnouncement this_ptr_conv;
15211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15212 this_ptr_conv.is_owned = false;
15213 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15214 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
15218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15219 LDKChannelAnnouncement this_ptr_conv;
15220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15221 this_ptr_conv.is_owned = false;
15222 LDKSignature val_ref;
15223 CHECK((*env)->GetArrayLength(env, val) == 64);
15224 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15225 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
15228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15229 LDKChannelAnnouncement this_ptr_conv;
15230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15231 this_ptr_conv.is_owned = false;
15232 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15233 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
15237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15238 LDKChannelAnnouncement this_ptr_conv;
15239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15240 this_ptr_conv.is_owned = false;
15241 LDKSignature val_ref;
15242 CHECK((*env)->GetArrayLength(env, val) == 64);
15243 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15244 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
15247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15248 LDKChannelAnnouncement this_ptr_conv;
15249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15250 this_ptr_conv.is_owned = false;
15251 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15252 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
15256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15257 LDKChannelAnnouncement this_ptr_conv;
15258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15259 this_ptr_conv.is_owned = false;
15260 LDKSignature val_ref;
15261 CHECK((*env)->GetArrayLength(env, val) == 64);
15262 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15263 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
15266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15267 LDKChannelAnnouncement this_ptr_conv;
15268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15269 this_ptr_conv.is_owned = false;
15270 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
15271 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15272 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15273 long ret_ref = (long)ret_var.inner;
15274 if (ret_var.is_owned) {
15280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15281 LDKChannelAnnouncement this_ptr_conv;
15282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15283 this_ptr_conv.is_owned = false;
15284 LDKUnsignedChannelAnnouncement val_conv;
15285 val_conv.inner = (void*)(val & (~1));
15286 val_conv.is_owned = (val & 1) || (val == 0);
15287 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
15288 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
15291 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) {
15292 LDKSignature node_signature_1_arg_ref;
15293 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
15294 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
15295 LDKSignature node_signature_2_arg_ref;
15296 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
15297 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
15298 LDKSignature bitcoin_signature_1_arg_ref;
15299 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
15300 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
15301 LDKSignature bitcoin_signature_2_arg_ref;
15302 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
15303 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
15304 LDKUnsignedChannelAnnouncement contents_arg_conv;
15305 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15306 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15307 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
15308 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);
15309 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15310 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15311 long ret_ref = (long)ret_var.inner;
15312 if (ret_var.is_owned) {
15318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15319 LDKChannelAnnouncement orig_conv;
15320 orig_conv.inner = (void*)(orig & (~1));
15321 orig_conv.is_owned = false;
15322 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
15323 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15324 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15325 long ret_ref = (long)ret_var.inner;
15326 if (ret_var.is_owned) {
15332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15333 LDKUnsignedChannelUpdate this_obj_conv;
15334 this_obj_conv.inner = (void*)(this_obj & (~1));
15335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15336 UnsignedChannelUpdate_free(this_obj_conv);
15339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15340 LDKUnsignedChannelUpdate this_ptr_conv;
15341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15342 this_ptr_conv.is_owned = false;
15343 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15344 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
15348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15349 LDKUnsignedChannelUpdate this_ptr_conv;
15350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15351 this_ptr_conv.is_owned = false;
15352 LDKThirtyTwoBytes val_ref;
15353 CHECK((*env)->GetArrayLength(env, val) == 32);
15354 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15355 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
15358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15359 LDKUnsignedChannelUpdate this_ptr_conv;
15360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15361 this_ptr_conv.is_owned = false;
15362 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
15366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15367 LDKUnsignedChannelUpdate this_ptr_conv;
15368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15369 this_ptr_conv.is_owned = false;
15370 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
15373 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15374 LDKUnsignedChannelUpdate this_ptr_conv;
15375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15376 this_ptr_conv.is_owned = false;
15377 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
15381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15382 LDKUnsignedChannelUpdate this_ptr_conv;
15383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15384 this_ptr_conv.is_owned = false;
15385 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
15388 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
15389 LDKUnsignedChannelUpdate this_ptr_conv;
15390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15391 this_ptr_conv.is_owned = false;
15392 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
15397 LDKUnsignedChannelUpdate this_ptr_conv;
15398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15399 this_ptr_conv.is_owned = false;
15400 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
15403 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15404 LDKUnsignedChannelUpdate this_ptr_conv;
15405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15406 this_ptr_conv.is_owned = false;
15407 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
15411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15412 LDKUnsignedChannelUpdate this_ptr_conv;
15413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15414 this_ptr_conv.is_owned = false;
15415 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15419 LDKUnsignedChannelUpdate this_ptr_conv;
15420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15421 this_ptr_conv.is_owned = false;
15422 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
15426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15427 LDKUnsignedChannelUpdate this_ptr_conv;
15428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15429 this_ptr_conv.is_owned = false;
15430 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
15433 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15434 LDKUnsignedChannelUpdate this_ptr_conv;
15435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15436 this_ptr_conv.is_owned = false;
15437 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
15441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15442 LDKUnsignedChannelUpdate this_ptr_conv;
15443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15444 this_ptr_conv.is_owned = false;
15445 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
15448 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15449 LDKUnsignedChannelUpdate this_ptr_conv;
15450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15451 this_ptr_conv.is_owned = false;
15452 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
15456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15457 LDKUnsignedChannelUpdate this_ptr_conv;
15458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15459 this_ptr_conv.is_owned = false;
15460 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
15463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15464 LDKUnsignedChannelUpdate orig_conv;
15465 orig_conv.inner = (void*)(orig & (~1));
15466 orig_conv.is_owned = false;
15467 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
15468 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15469 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15470 long ret_ref = (long)ret_var.inner;
15471 if (ret_var.is_owned) {
15477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15478 LDKChannelUpdate this_obj_conv;
15479 this_obj_conv.inner = (void*)(this_obj & (~1));
15480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15481 ChannelUpdate_free(this_obj_conv);
15484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15485 LDKChannelUpdate this_ptr_conv;
15486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15487 this_ptr_conv.is_owned = false;
15488 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
15493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15494 LDKChannelUpdate this_ptr_conv;
15495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15496 this_ptr_conv.is_owned = false;
15497 LDKSignature val_ref;
15498 CHECK((*env)->GetArrayLength(env, val) == 64);
15499 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15500 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15504 LDKChannelUpdate this_ptr_conv;
15505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15506 this_ptr_conv.is_owned = false;
15507 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_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_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15518 LDKChannelUpdate this_ptr_conv;
15519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15520 this_ptr_conv.is_owned = false;
15521 LDKUnsignedChannelUpdate val_conv;
15522 val_conv.inner = (void*)(val & (~1));
15523 val_conv.is_owned = (val & 1) || (val == 0);
15524 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15525 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
15529 LDKSignature signature_arg_ref;
15530 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
15531 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
15532 LDKUnsignedChannelUpdate contents_arg_conv;
15533 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15534 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15535 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15536 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15539 long ret_ref = (long)ret_var.inner;
15540 if (ret_var.is_owned) {
15546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15547 LDKChannelUpdate orig_conv;
15548 orig_conv.inner = (void*)(orig & (~1));
15549 orig_conv.is_owned = false;
15550 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15553 long ret_ref = (long)ret_var.inner;
15554 if (ret_var.is_owned) {
15560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15561 LDKQueryChannelRange this_obj_conv;
15562 this_obj_conv.inner = (void*)(this_obj & (~1));
15563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15564 QueryChannelRange_free(this_obj_conv);
15567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15568 LDKQueryChannelRange this_ptr_conv;
15569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15570 this_ptr_conv.is_owned = false;
15571 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15572 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
15576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15577 LDKQueryChannelRange this_ptr_conv;
15578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15579 this_ptr_conv.is_owned = false;
15580 LDKThirtyTwoBytes val_ref;
15581 CHECK((*env)->GetArrayLength(env, val) == 32);
15582 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15583 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15586 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15587 LDKQueryChannelRange this_ptr_conv;
15588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15589 this_ptr_conv.is_owned = false;
15590 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15595 LDKQueryChannelRange this_ptr_conv;
15596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15597 this_ptr_conv.is_owned = false;
15598 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15601 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15602 LDKQueryChannelRange this_ptr_conv;
15603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15604 this_ptr_conv.is_owned = false;
15605 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15610 LDKQueryChannelRange this_ptr_conv;
15611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15612 this_ptr_conv.is_owned = false;
15613 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15616 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) {
15617 LDKThirtyTwoBytes chain_hash_arg_ref;
15618 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15619 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15620 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15623 long ret_ref = (long)ret_var.inner;
15624 if (ret_var.is_owned) {
15630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15631 LDKQueryChannelRange orig_conv;
15632 orig_conv.inner = (void*)(orig & (~1));
15633 orig_conv.is_owned = false;
15634 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15637 long ret_ref = (long)ret_var.inner;
15638 if (ret_var.is_owned) {
15644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15645 LDKReplyChannelRange this_obj_conv;
15646 this_obj_conv.inner = (void*)(this_obj & (~1));
15647 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15648 ReplyChannelRange_free(this_obj_conv);
15651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15652 LDKReplyChannelRange this_ptr_conv;
15653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15654 this_ptr_conv.is_owned = false;
15655 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15656 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
15660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15661 LDKReplyChannelRange this_ptr_conv;
15662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15663 this_ptr_conv.is_owned = false;
15664 LDKThirtyTwoBytes val_ref;
15665 CHECK((*env)->GetArrayLength(env, val) == 32);
15666 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15667 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15670 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15671 LDKReplyChannelRange this_ptr_conv;
15672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15673 this_ptr_conv.is_owned = false;
15674 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
15678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15679 LDKReplyChannelRange this_ptr_conv;
15680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15681 this_ptr_conv.is_owned = false;
15682 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
15685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15686 LDKReplyChannelRange this_ptr_conv;
15687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15688 this_ptr_conv.is_owned = false;
15689 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
15693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15694 LDKReplyChannelRange this_ptr_conv;
15695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15696 this_ptr_conv.is_owned = false;
15697 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
15701 LDKReplyChannelRange this_ptr_conv;
15702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15703 this_ptr_conv.is_owned = false;
15704 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
15708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15709 LDKReplyChannelRange this_ptr_conv;
15710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15711 this_ptr_conv.is_owned = false;
15712 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
15715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15716 LDKReplyChannelRange this_ptr_conv;
15717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15718 this_ptr_conv.is_owned = false;
15719 LDKCVec_u64Z val_constr;
15720 val_constr.datalen = (*env)->GetArrayLength(env, val);
15721 if (val_constr.datalen > 0)
15722 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15724 val_constr.data = NULL;
15725 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15726 for (size_t g = 0; g < val_constr.datalen; g++) {
15727 int64_t val_conv_6 = val_vals[g];
15728 val_constr.data[g] = val_conv_6;
15730 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15731 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
15734 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) {
15735 LDKThirtyTwoBytes chain_hash_arg_ref;
15736 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15737 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15738 LDKCVec_u64Z short_channel_ids_arg_constr;
15739 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15740 if (short_channel_ids_arg_constr.datalen > 0)
15741 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15743 short_channel_ids_arg_constr.data = NULL;
15744 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15745 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15746 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15747 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15749 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15750 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
15751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15753 long ret_ref = (long)ret_var.inner;
15754 if (ret_var.is_owned) {
15760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15761 LDKReplyChannelRange orig_conv;
15762 orig_conv.inner = (void*)(orig & (~1));
15763 orig_conv.is_owned = false;
15764 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
15765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15767 long ret_ref = (long)ret_var.inner;
15768 if (ret_var.is_owned) {
15774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15775 LDKQueryShortChannelIds this_obj_conv;
15776 this_obj_conv.inner = (void*)(this_obj & (~1));
15777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15778 QueryShortChannelIds_free(this_obj_conv);
15781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15782 LDKQueryShortChannelIds this_ptr_conv;
15783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15784 this_ptr_conv.is_owned = false;
15785 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15786 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
15790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15791 LDKQueryShortChannelIds this_ptr_conv;
15792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15793 this_ptr_conv.is_owned = false;
15794 LDKThirtyTwoBytes val_ref;
15795 CHECK((*env)->GetArrayLength(env, val) == 32);
15796 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15797 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
15800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15801 LDKQueryShortChannelIds this_ptr_conv;
15802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15803 this_ptr_conv.is_owned = false;
15804 LDKCVec_u64Z val_constr;
15805 val_constr.datalen = (*env)->GetArrayLength(env, val);
15806 if (val_constr.datalen > 0)
15807 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15809 val_constr.data = NULL;
15810 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15811 for (size_t g = 0; g < val_constr.datalen; g++) {
15812 int64_t val_conv_6 = val_vals[g];
15813 val_constr.data[g] = val_conv_6;
15815 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15816 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
15819 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) {
15820 LDKThirtyTwoBytes chain_hash_arg_ref;
15821 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15822 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15823 LDKCVec_u64Z short_channel_ids_arg_constr;
15824 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15825 if (short_channel_ids_arg_constr.datalen > 0)
15826 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15828 short_channel_ids_arg_constr.data = NULL;
15829 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15830 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15831 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15832 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15834 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15835 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
15836 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15837 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15838 long ret_ref = (long)ret_var.inner;
15839 if (ret_var.is_owned) {
15845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15846 LDKQueryShortChannelIds orig_conv;
15847 orig_conv.inner = (void*)(orig & (~1));
15848 orig_conv.is_owned = false;
15849 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
15850 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15851 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15852 long ret_ref = (long)ret_var.inner;
15853 if (ret_var.is_owned) {
15859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15860 LDKReplyShortChannelIdsEnd this_obj_conv;
15861 this_obj_conv.inner = (void*)(this_obj & (~1));
15862 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15863 ReplyShortChannelIdsEnd_free(this_obj_conv);
15866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15867 LDKReplyShortChannelIdsEnd this_ptr_conv;
15868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15869 this_ptr_conv.is_owned = false;
15870 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15871 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
15875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15876 LDKReplyShortChannelIdsEnd this_ptr_conv;
15877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15878 this_ptr_conv.is_owned = false;
15879 LDKThirtyTwoBytes val_ref;
15880 CHECK((*env)->GetArrayLength(env, val) == 32);
15881 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15882 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
15885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
15886 LDKReplyShortChannelIdsEnd this_ptr_conv;
15887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15888 this_ptr_conv.is_owned = false;
15889 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
15893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15894 LDKReplyShortChannelIdsEnd this_ptr_conv;
15895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15896 this_ptr_conv.is_owned = false;
15897 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
15900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
15901 LDKThirtyTwoBytes chain_hash_arg_ref;
15902 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15903 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15904 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
15905 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15906 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15907 long ret_ref = (long)ret_var.inner;
15908 if (ret_var.is_owned) {
15914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15915 LDKReplyShortChannelIdsEnd orig_conv;
15916 orig_conv.inner = (void*)(orig & (~1));
15917 orig_conv.is_owned = false;
15918 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
15919 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15920 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15921 long ret_ref = (long)ret_var.inner;
15922 if (ret_var.is_owned) {
15928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15929 LDKGossipTimestampFilter this_obj_conv;
15930 this_obj_conv.inner = (void*)(this_obj & (~1));
15931 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15932 GossipTimestampFilter_free(this_obj_conv);
15935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15936 LDKGossipTimestampFilter this_ptr_conv;
15937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15938 this_ptr_conv.is_owned = false;
15939 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15940 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
15944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15945 LDKGossipTimestampFilter this_ptr_conv;
15946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15947 this_ptr_conv.is_owned = false;
15948 LDKThirtyTwoBytes val_ref;
15949 CHECK((*env)->GetArrayLength(env, val) == 32);
15950 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15951 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15954 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15955 LDKGossipTimestampFilter this_ptr_conv;
15956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15957 this_ptr_conv.is_owned = false;
15958 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15963 LDKGossipTimestampFilter this_ptr_conv;
15964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15965 this_ptr_conv.is_owned = false;
15966 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15969 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
15970 LDKGossipTimestampFilter this_ptr_conv;
15971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15972 this_ptr_conv.is_owned = false;
15973 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15978 LDKGossipTimestampFilter this_ptr_conv;
15979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15980 this_ptr_conv.is_owned = false;
15981 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15984 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) {
15985 LDKThirtyTwoBytes chain_hash_arg_ref;
15986 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15987 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15988 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15989 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15990 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15991 long ret_ref = (long)ret_var.inner;
15992 if (ret_var.is_owned) {
15998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15999 LDKGossipTimestampFilter orig_conv;
16000 orig_conv.inner = (void*)(orig & (~1));
16001 orig_conv.is_owned = false;
16002 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
16003 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16004 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16005 long ret_ref = (long)ret_var.inner;
16006 if (ret_var.is_owned) {
16012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16013 if ((this_ptr & 1) != 0) return;
16014 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
16015 FREE((void*)this_ptr);
16016 ErrorAction_free(this_ptr_conv);
16019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16020 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
16021 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
16022 *ret_copy = ErrorAction_clone(orig_conv);
16023 long ret_ref = (long)ret_copy;
16027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16028 LDKLightningError this_obj_conv;
16029 this_obj_conv.inner = (void*)(this_obj & (~1));
16030 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16031 LightningError_free(this_obj_conv);
16034 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
16035 LDKLightningError this_ptr_conv;
16036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16037 this_ptr_conv.is_owned = false;
16038 LDKStr _str = LightningError_get_err(&this_ptr_conv);
16039 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
16043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16044 LDKLightningError this_ptr_conv;
16045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16046 this_ptr_conv.is_owned = false;
16047 LDKCVec_u8Z val_ref;
16048 val_ref.datalen = (*env)->GetArrayLength(env, val);
16049 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16050 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16051 LightningError_set_err(&this_ptr_conv, val_ref);
16054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
16055 LDKLightningError this_ptr_conv;
16056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16057 this_ptr_conv.is_owned = false;
16058 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
16059 *ret_copy = LightningError_get_action(&this_ptr_conv);
16060 long ret_ref = (long)ret_copy;
16064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16065 LDKLightningError this_ptr_conv;
16066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16067 this_ptr_conv.is_owned = false;
16068 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
16070 LightningError_set_action(&this_ptr_conv, val_conv);
16073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
16074 LDKCVec_u8Z err_arg_ref;
16075 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
16076 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16077 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
16078 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
16079 FREE((void*)action_arg);
16080 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
16081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16083 long ret_ref = (long)ret_var.inner;
16084 if (ret_var.is_owned) {
16090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16091 LDKLightningError orig_conv;
16092 orig_conv.inner = (void*)(orig & (~1));
16093 orig_conv.is_owned = false;
16094 LDKLightningError ret_var = LightningError_clone(&orig_conv);
16095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16097 long ret_ref = (long)ret_var.inner;
16098 if (ret_var.is_owned) {
16104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16105 LDKCommitmentUpdate this_obj_conv;
16106 this_obj_conv.inner = (void*)(this_obj & (~1));
16107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16108 CommitmentUpdate_free(this_obj_conv);
16111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16112 LDKCommitmentUpdate this_ptr_conv;
16113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16114 this_ptr_conv.is_owned = false;
16115 LDKCVec_UpdateAddHTLCZ val_constr;
16116 val_constr.datalen = (*env)->GetArrayLength(env, val);
16117 if (val_constr.datalen > 0)
16118 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16120 val_constr.data = NULL;
16121 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16122 for (size_t p = 0; p < val_constr.datalen; p++) {
16123 int64_t val_conv_15 = val_vals[p];
16124 LDKUpdateAddHTLC val_conv_15_conv;
16125 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
16126 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
16127 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
16128 val_constr.data[p] = val_conv_15_conv;
16130 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16131 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
16134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16135 LDKCommitmentUpdate this_ptr_conv;
16136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16137 this_ptr_conv.is_owned = false;
16138 LDKCVec_UpdateFulfillHTLCZ val_constr;
16139 val_constr.datalen = (*env)->GetArrayLength(env, val);
16140 if (val_constr.datalen > 0)
16141 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16143 val_constr.data = NULL;
16144 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16145 for (size_t t = 0; t < val_constr.datalen; t++) {
16146 int64_t val_conv_19 = val_vals[t];
16147 LDKUpdateFulfillHTLC val_conv_19_conv;
16148 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
16149 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
16150 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
16151 val_constr.data[t] = val_conv_19_conv;
16153 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16154 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
16157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16158 LDKCommitmentUpdate this_ptr_conv;
16159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16160 this_ptr_conv.is_owned = false;
16161 LDKCVec_UpdateFailHTLCZ val_constr;
16162 val_constr.datalen = (*env)->GetArrayLength(env, val);
16163 if (val_constr.datalen > 0)
16164 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16166 val_constr.data = NULL;
16167 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16168 for (size_t q = 0; q < val_constr.datalen; q++) {
16169 int64_t val_conv_16 = val_vals[q];
16170 LDKUpdateFailHTLC val_conv_16_conv;
16171 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
16172 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
16173 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
16174 val_constr.data[q] = val_conv_16_conv;
16176 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16177 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
16180 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) {
16181 LDKCommitmentUpdate this_ptr_conv;
16182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16183 this_ptr_conv.is_owned = false;
16184 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
16185 val_constr.datalen = (*env)->GetArrayLength(env, val);
16186 if (val_constr.datalen > 0)
16187 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16189 val_constr.data = NULL;
16190 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16191 for (size_t z = 0; z < val_constr.datalen; z++) {
16192 int64_t val_conv_25 = val_vals[z];
16193 LDKUpdateFailMalformedHTLC val_conv_25_conv;
16194 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
16195 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
16196 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
16197 val_constr.data[z] = val_conv_25_conv;
16199 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16200 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
16203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
16204 LDKCommitmentUpdate this_ptr_conv;
16205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16206 this_ptr_conv.is_owned = false;
16207 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
16208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16210 long ret_ref = (long)ret_var.inner;
16211 if (ret_var.is_owned) {
16217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16218 LDKCommitmentUpdate this_ptr_conv;
16219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16220 this_ptr_conv.is_owned = false;
16221 LDKUpdateFee val_conv;
16222 val_conv.inner = (void*)(val & (~1));
16223 val_conv.is_owned = (val & 1) || (val == 0);
16224 val_conv = UpdateFee_clone(&val_conv);
16225 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
16228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
16229 LDKCommitmentUpdate this_ptr_conv;
16230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16231 this_ptr_conv.is_owned = false;
16232 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
16233 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16234 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16235 long ret_ref = (long)ret_var.inner;
16236 if (ret_var.is_owned) {
16242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16243 LDKCommitmentUpdate this_ptr_conv;
16244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16245 this_ptr_conv.is_owned = false;
16246 LDKCommitmentSigned val_conv;
16247 val_conv.inner = (void*)(val & (~1));
16248 val_conv.is_owned = (val & 1) || (val == 0);
16249 val_conv = CommitmentSigned_clone(&val_conv);
16250 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
16253 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) {
16254 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
16255 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
16256 if (update_add_htlcs_arg_constr.datalen > 0)
16257 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16259 update_add_htlcs_arg_constr.data = NULL;
16260 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
16261 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
16262 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
16263 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
16264 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
16265 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
16266 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
16267 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
16269 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
16270 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
16271 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
16272 if (update_fulfill_htlcs_arg_constr.datalen > 0)
16273 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16275 update_fulfill_htlcs_arg_constr.data = NULL;
16276 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
16277 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
16278 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
16279 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
16280 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
16281 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
16282 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
16283 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
16285 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
16286 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
16287 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
16288 if (update_fail_htlcs_arg_constr.datalen > 0)
16289 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16291 update_fail_htlcs_arg_constr.data = NULL;
16292 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
16293 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
16294 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
16295 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
16296 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
16297 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
16298 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
16299 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
16301 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
16302 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
16303 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
16304 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
16305 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16307 update_fail_malformed_htlcs_arg_constr.data = NULL;
16308 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
16309 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
16310 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
16311 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
16312 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
16313 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);
16314 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
16315 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
16317 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
16318 LDKUpdateFee update_fee_arg_conv;
16319 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
16320 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
16321 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
16322 LDKCommitmentSigned commitment_signed_arg_conv;
16323 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
16324 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
16325 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
16326 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);
16327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16329 long ret_ref = (long)ret_var.inner;
16330 if (ret_var.is_owned) {
16336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16337 LDKCommitmentUpdate orig_conv;
16338 orig_conv.inner = (void*)(orig & (~1));
16339 orig_conv.is_owned = false;
16340 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
16341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16343 long ret_ref = (long)ret_var.inner;
16344 if (ret_var.is_owned) {
16350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16351 if ((this_ptr & 1) != 0) return;
16352 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
16353 FREE((void*)this_ptr);
16354 HTLCFailChannelUpdate_free(this_ptr_conv);
16357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16358 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
16359 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
16360 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
16361 long ret_ref = (long)ret_copy;
16365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16366 if ((this_ptr & 1) != 0) return;
16367 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
16368 FREE((void*)this_ptr);
16369 ChannelMessageHandler_free(this_ptr_conv);
16372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16373 if ((this_ptr & 1) != 0) return;
16374 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
16375 FREE((void*)this_ptr);
16376 RoutingMessageHandler_free(this_ptr_conv);
16379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16380 LDKAcceptChannel obj_conv;
16381 obj_conv.inner = (void*)(obj & (~1));
16382 obj_conv.is_owned = false;
16383 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
16384 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16385 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16386 CVec_u8Z_free(ret_var);
16390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16391 LDKu8slice ser_ref;
16392 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16393 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16394 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
16395 *ret_conv = AcceptChannel_read(ser_ref);
16396 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16397 return (long)ret_conv;
16400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
16401 LDKAnnouncementSignatures obj_conv;
16402 obj_conv.inner = (void*)(obj & (~1));
16403 obj_conv.is_owned = false;
16404 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
16405 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16406 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16407 CVec_u8Z_free(ret_var);
16411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16412 LDKu8slice ser_ref;
16413 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16414 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16415 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
16416 *ret_conv = AnnouncementSignatures_read(ser_ref);
16417 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16418 return (long)ret_conv;
16421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
16422 LDKChannelReestablish obj_conv;
16423 obj_conv.inner = (void*)(obj & (~1));
16424 obj_conv.is_owned = false;
16425 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
16426 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16427 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16428 CVec_u8Z_free(ret_var);
16432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16433 LDKu8slice ser_ref;
16434 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16435 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16436 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
16437 *ret_conv = ChannelReestablish_read(ser_ref);
16438 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16439 return (long)ret_conv;
16442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16443 LDKClosingSigned obj_conv;
16444 obj_conv.inner = (void*)(obj & (~1));
16445 obj_conv.is_owned = false;
16446 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
16447 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16448 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16449 CVec_u8Z_free(ret_var);
16453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16454 LDKu8slice ser_ref;
16455 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16456 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16457 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
16458 *ret_conv = ClosingSigned_read(ser_ref);
16459 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16460 return (long)ret_conv;
16463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16464 LDKCommitmentSigned obj_conv;
16465 obj_conv.inner = (void*)(obj & (~1));
16466 obj_conv.is_owned = false;
16467 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
16468 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16469 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16470 CVec_u8Z_free(ret_var);
16474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16475 LDKu8slice ser_ref;
16476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16478 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
16479 *ret_conv = CommitmentSigned_read(ser_ref);
16480 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16481 return (long)ret_conv;
16484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
16485 LDKFundingCreated obj_conv;
16486 obj_conv.inner = (void*)(obj & (~1));
16487 obj_conv.is_owned = false;
16488 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16489 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16490 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16491 CVec_u8Z_free(ret_var);
16495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16496 LDKu8slice ser_ref;
16497 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16498 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16499 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16500 *ret_conv = FundingCreated_read(ser_ref);
16501 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16502 return (long)ret_conv;
16505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16506 LDKFundingSigned obj_conv;
16507 obj_conv.inner = (void*)(obj & (~1));
16508 obj_conv.is_owned = false;
16509 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16510 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16511 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16512 CVec_u8Z_free(ret_var);
16516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16517 LDKu8slice ser_ref;
16518 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16519 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16520 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16521 *ret_conv = FundingSigned_read(ser_ref);
16522 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16523 return (long)ret_conv;
16526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
16527 LDKFundingLocked obj_conv;
16528 obj_conv.inner = (void*)(obj & (~1));
16529 obj_conv.is_owned = false;
16530 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16531 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16532 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16533 CVec_u8Z_free(ret_var);
16537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16538 LDKu8slice ser_ref;
16539 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16540 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16541 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16542 *ret_conv = FundingLocked_read(ser_ref);
16543 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16544 return (long)ret_conv;
16547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
16549 obj_conv.inner = (void*)(obj & (~1));
16550 obj_conv.is_owned = false;
16551 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16552 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16553 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16554 CVec_u8Z_free(ret_var);
16558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16559 LDKu8slice ser_ref;
16560 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16561 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16562 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16563 *ret_conv = Init_read(ser_ref);
16564 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16565 return (long)ret_conv;
16568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16569 LDKOpenChannel obj_conv;
16570 obj_conv.inner = (void*)(obj & (~1));
16571 obj_conv.is_owned = false;
16572 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16573 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16574 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16575 CVec_u8Z_free(ret_var);
16579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16580 LDKu8slice ser_ref;
16581 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16582 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16583 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16584 *ret_conv = OpenChannel_read(ser_ref);
16585 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16586 return (long)ret_conv;
16589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
16590 LDKRevokeAndACK obj_conv;
16591 obj_conv.inner = (void*)(obj & (~1));
16592 obj_conv.is_owned = false;
16593 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16594 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16595 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16596 CVec_u8Z_free(ret_var);
16600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16601 LDKu8slice ser_ref;
16602 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16603 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16604 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16605 *ret_conv = RevokeAndACK_read(ser_ref);
16606 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16607 return (long)ret_conv;
16610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
16611 LDKShutdown obj_conv;
16612 obj_conv.inner = (void*)(obj & (~1));
16613 obj_conv.is_owned = false;
16614 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16615 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16616 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16617 CVec_u8Z_free(ret_var);
16621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16622 LDKu8slice ser_ref;
16623 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16624 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16625 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16626 *ret_conv = Shutdown_read(ser_ref);
16627 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16628 return (long)ret_conv;
16631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16632 LDKUpdateFailHTLC obj_conv;
16633 obj_conv.inner = (void*)(obj & (~1));
16634 obj_conv.is_owned = false;
16635 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16636 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16637 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16638 CVec_u8Z_free(ret_var);
16642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16643 LDKu8slice ser_ref;
16644 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16645 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16646 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16647 *ret_conv = UpdateFailHTLC_read(ser_ref);
16648 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16649 return (long)ret_conv;
16652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16653 LDKUpdateFailMalformedHTLC obj_conv;
16654 obj_conv.inner = (void*)(obj & (~1));
16655 obj_conv.is_owned = false;
16656 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16657 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16658 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16659 CVec_u8Z_free(ret_var);
16663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16664 LDKu8slice ser_ref;
16665 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16666 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16667 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16668 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16669 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16670 return (long)ret_conv;
16673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
16674 LDKUpdateFee obj_conv;
16675 obj_conv.inner = (void*)(obj & (~1));
16676 obj_conv.is_owned = false;
16677 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
16678 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16679 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16680 CVec_u8Z_free(ret_var);
16684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16685 LDKu8slice ser_ref;
16686 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16687 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16688 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16689 *ret_conv = UpdateFee_read(ser_ref);
16690 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16691 return (long)ret_conv;
16694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16695 LDKUpdateFulfillHTLC obj_conv;
16696 obj_conv.inner = (void*)(obj & (~1));
16697 obj_conv.is_owned = false;
16698 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
16699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16701 CVec_u8Z_free(ret_var);
16705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16706 LDKu8slice ser_ref;
16707 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16708 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16709 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16710 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
16711 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16712 return (long)ret_conv;
16715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16716 LDKUpdateAddHTLC obj_conv;
16717 obj_conv.inner = (void*)(obj & (~1));
16718 obj_conv.is_owned = false;
16719 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
16720 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16721 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16722 CVec_u8Z_free(ret_var);
16726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16727 LDKu8slice ser_ref;
16728 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16729 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16730 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16731 *ret_conv = UpdateAddHTLC_read(ser_ref);
16732 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16733 return (long)ret_conv;
16736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
16738 obj_conv.inner = (void*)(obj & (~1));
16739 obj_conv.is_owned = false;
16740 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
16741 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16742 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16743 CVec_u8Z_free(ret_var);
16747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16748 LDKu8slice ser_ref;
16749 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16750 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16751 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16752 *ret_conv = Ping_read(ser_ref);
16753 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16754 return (long)ret_conv;
16757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
16759 obj_conv.inner = (void*)(obj & (~1));
16760 obj_conv.is_owned = false;
16761 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
16762 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16763 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16764 CVec_u8Z_free(ret_var);
16768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16769 LDKu8slice ser_ref;
16770 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16771 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16772 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16773 *ret_conv = Pong_read(ser_ref);
16774 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16775 return (long)ret_conv;
16778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16779 LDKUnsignedChannelAnnouncement obj_conv;
16780 obj_conv.inner = (void*)(obj & (~1));
16781 obj_conv.is_owned = false;
16782 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
16783 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16784 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16785 CVec_u8Z_free(ret_var);
16789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16790 LDKu8slice ser_ref;
16791 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16792 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16793 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16794 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
16795 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16796 return (long)ret_conv;
16799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16800 LDKChannelAnnouncement obj_conv;
16801 obj_conv.inner = (void*)(obj & (~1));
16802 obj_conv.is_owned = false;
16803 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
16804 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16805 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16806 CVec_u8Z_free(ret_var);
16810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16811 LDKu8slice ser_ref;
16812 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16813 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16814 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16815 *ret_conv = ChannelAnnouncement_read(ser_ref);
16816 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16817 return (long)ret_conv;
16820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16821 LDKUnsignedChannelUpdate obj_conv;
16822 obj_conv.inner = (void*)(obj & (~1));
16823 obj_conv.is_owned = false;
16824 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
16825 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16826 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16827 CVec_u8Z_free(ret_var);
16831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16832 LDKu8slice ser_ref;
16833 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16834 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16835 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16836 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
16837 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16838 return (long)ret_conv;
16841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16842 LDKChannelUpdate obj_conv;
16843 obj_conv.inner = (void*)(obj & (~1));
16844 obj_conv.is_owned = false;
16845 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
16846 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16847 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16848 CVec_u8Z_free(ret_var);
16852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16853 LDKu8slice ser_ref;
16854 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16855 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16856 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16857 *ret_conv = ChannelUpdate_read(ser_ref);
16858 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16859 return (long)ret_conv;
16862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
16863 LDKErrorMessage obj_conv;
16864 obj_conv.inner = (void*)(obj & (~1));
16865 obj_conv.is_owned = false;
16866 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
16867 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16868 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16869 CVec_u8Z_free(ret_var);
16873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16874 LDKu8slice ser_ref;
16875 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16876 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16877 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16878 *ret_conv = ErrorMessage_read(ser_ref);
16879 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16880 return (long)ret_conv;
16883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16884 LDKUnsignedNodeAnnouncement obj_conv;
16885 obj_conv.inner = (void*)(obj & (~1));
16886 obj_conv.is_owned = false;
16887 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
16888 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16889 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16890 CVec_u8Z_free(ret_var);
16894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16895 LDKu8slice ser_ref;
16896 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16897 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16898 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16899 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
16900 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16901 return (long)ret_conv;
16904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16905 LDKNodeAnnouncement obj_conv;
16906 obj_conv.inner = (void*)(obj & (~1));
16907 obj_conv.is_owned = false;
16908 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
16909 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16910 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16911 CVec_u8Z_free(ret_var);
16915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16916 LDKu8slice ser_ref;
16917 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16918 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16919 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16920 *ret_conv = NodeAnnouncement_read(ser_ref);
16921 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16922 return (long)ret_conv;
16925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16926 LDKu8slice ser_ref;
16927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16929 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16930 *ret_conv = QueryShortChannelIds_read(ser_ref);
16931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16932 return (long)ret_conv;
16935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
16936 LDKQueryShortChannelIds obj_conv;
16937 obj_conv.inner = (void*)(obj & (~1));
16938 obj_conv.is_owned = false;
16939 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
16940 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16941 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16942 CVec_u8Z_free(ret_var);
16946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16947 LDKu8slice ser_ref;
16948 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16949 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16950 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16951 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
16952 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16953 return (long)ret_conv;
16956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
16957 LDKReplyShortChannelIdsEnd obj_conv;
16958 obj_conv.inner = (void*)(obj & (~1));
16959 obj_conv.is_owned = false;
16960 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
16961 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16962 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16963 CVec_u8Z_free(ret_var);
16967 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
16968 LDKQueryChannelRange this_arg_conv;
16969 this_arg_conv.inner = (void*)(this_arg & (~1));
16970 this_arg_conv.is_owned = false;
16971 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
16975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16976 LDKu8slice ser_ref;
16977 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16978 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16979 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16980 *ret_conv = QueryChannelRange_read(ser_ref);
16981 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16982 return (long)ret_conv;
16985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
16986 LDKQueryChannelRange obj_conv;
16987 obj_conv.inner = (void*)(obj & (~1));
16988 obj_conv.is_owned = false;
16989 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16992 CVec_u8Z_free(ret_var);
16996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16997 LDKu8slice ser_ref;
16998 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16999 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17000 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
17001 *ret_conv = ReplyChannelRange_read(ser_ref);
17002 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17003 return (long)ret_conv;
17006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
17007 LDKReplyChannelRange obj_conv;
17008 obj_conv.inner = (void*)(obj & (~1));
17009 obj_conv.is_owned = false;
17010 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
17011 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17012 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17013 CVec_u8Z_free(ret_var);
17017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17018 LDKu8slice ser_ref;
17019 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17020 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17021 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
17022 *ret_conv = GossipTimestampFilter_read(ser_ref);
17023 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17024 return (long)ret_conv;
17027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
17028 LDKGossipTimestampFilter obj_conv;
17029 obj_conv.inner = (void*)(obj & (~1));
17030 obj_conv.is_owned = false;
17031 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
17032 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17033 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17034 CVec_u8Z_free(ret_var);
17038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17039 LDKIgnoringMessageHandler this_obj_conv;
17040 this_obj_conv.inner = (void*)(this_obj & (~1));
17041 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17042 IgnoringMessageHandler_free(this_obj_conv);
17045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
17046 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
17047 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17048 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17049 long ret_ref = (long)ret_var.inner;
17050 if (ret_var.is_owned) {
17056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17057 LDKIgnoringMessageHandler this_arg_conv;
17058 this_arg_conv.inner = (void*)(this_arg & (~1));
17059 this_arg_conv.is_owned = false;
17060 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17061 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
17065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17066 LDKIgnoringMessageHandler this_arg_conv;
17067 this_arg_conv.inner = (void*)(this_arg & (~1));
17068 this_arg_conv.is_owned = false;
17069 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17070 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
17074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17075 LDKErroringMessageHandler this_obj_conv;
17076 this_obj_conv.inner = (void*)(this_obj & (~1));
17077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17078 ErroringMessageHandler_free(this_obj_conv);
17081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
17082 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
17083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17085 long ret_ref = (long)ret_var.inner;
17086 if (ret_var.is_owned) {
17092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17093 LDKErroringMessageHandler this_arg_conv;
17094 this_arg_conv.inner = (void*)(this_arg & (~1));
17095 this_arg_conv.is_owned = false;
17096 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17097 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
17101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17102 LDKErroringMessageHandler this_arg_conv;
17103 this_arg_conv.inner = (void*)(this_arg & (~1));
17104 this_arg_conv.is_owned = false;
17105 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17106 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
17110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17111 LDKMessageHandler this_obj_conv;
17112 this_obj_conv.inner = (void*)(this_obj & (~1));
17113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17114 MessageHandler_free(this_obj_conv);
17117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17118 LDKMessageHandler this_ptr_conv;
17119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17120 this_ptr_conv.is_owned = false;
17121 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
17125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17126 LDKMessageHandler this_ptr_conv;
17127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17128 this_ptr_conv.is_owned = false;
17129 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
17130 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
17131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17132 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
17134 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
17137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17138 LDKMessageHandler this_ptr_conv;
17139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17140 this_ptr_conv.is_owned = false;
17141 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
17145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17146 LDKMessageHandler this_ptr_conv;
17147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17148 this_ptr_conv.is_owned = false;
17149 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
17150 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17151 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17152 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
17154 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
17157 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) {
17158 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
17159 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
17160 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17161 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
17163 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
17164 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17165 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17166 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
17168 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
17169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17171 long ret_ref = (long)ret_var.inner;
17172 if (ret_var.is_owned) {
17178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17179 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
17180 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17181 *ret = SocketDescriptor_clone(orig_conv);
17185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17186 if ((this_ptr & 1) != 0) return;
17187 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
17188 FREE((void*)this_ptr);
17189 SocketDescriptor_free(this_ptr_conv);
17192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17193 LDKPeerHandleError this_obj_conv;
17194 this_obj_conv.inner = (void*)(this_obj & (~1));
17195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17196 PeerHandleError_free(this_obj_conv);
17199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
17200 LDKPeerHandleError this_ptr_conv;
17201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17202 this_ptr_conv.is_owned = false;
17203 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
17207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17208 LDKPeerHandleError this_ptr_conv;
17209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17210 this_ptr_conv.is_owned = false;
17211 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
17214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
17215 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
17216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17218 long ret_ref = (long)ret_var.inner;
17219 if (ret_var.is_owned) {
17225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17226 LDKPeerHandleError orig_conv;
17227 orig_conv.inner = (void*)(orig & (~1));
17228 orig_conv.is_owned = false;
17229 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
17230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17232 long ret_ref = (long)ret_var.inner;
17233 if (ret_var.is_owned) {
17239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17240 LDKPeerManager this_obj_conv;
17241 this_obj_conv.inner = (void*)(this_obj & (~1));
17242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17243 PeerManager_free(this_obj_conv);
17246 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) {
17247 LDKMessageHandler message_handler_conv;
17248 message_handler_conv.inner = (void*)(message_handler & (~1));
17249 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
17250 // Warning: we need a move here but no clone is available for LDKMessageHandler
17251 LDKSecretKey our_node_secret_ref;
17252 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
17253 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
17254 unsigned char ephemeral_random_data_arr[32];
17255 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
17256 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
17257 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
17258 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17259 if (logger_conv.free == LDKLogger_JCalls_free) {
17260 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17261 LDKLogger_JCalls_clone(logger_conv.this_arg);
17263 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
17264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17266 long ret_ref = (long)ret_var.inner;
17267 if (ret_var.is_owned) {
17273 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
17274 LDKPeerManager this_arg_conv;
17275 this_arg_conv.inner = (void*)(this_arg & (~1));
17276 this_arg_conv.is_owned = false;
17277 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
17278 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17280 for (size_t i = 0; i < ret_var.datalen; i++) {
17281 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
17282 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
17283 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17285 FREE(ret_var.data);
17289 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) {
17290 LDKPeerManager this_arg_conv;
17291 this_arg_conv.inner = (void*)(this_arg & (~1));
17292 this_arg_conv.is_owned = false;
17293 LDKPublicKey their_node_id_ref;
17294 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17295 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17296 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17297 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17298 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17299 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17301 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17302 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
17303 return (long)ret_conv;
17306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17307 LDKPeerManager this_arg_conv;
17308 this_arg_conv.inner = (void*)(this_arg & (~1));
17309 this_arg_conv.is_owned = false;
17310 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17311 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17312 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17313 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17315 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17316 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
17317 return (long)ret_conv;
17320 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) {
17321 LDKPeerManager this_arg_conv;
17322 this_arg_conv.inner = (void*)(this_arg & (~1));
17323 this_arg_conv.is_owned = false;
17324 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17325 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17326 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
17327 return (long)ret_conv;
17330 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) {
17331 LDKPeerManager this_arg_conv;
17332 this_arg_conv.inner = (void*)(this_arg & (~1));
17333 this_arg_conv.is_owned = false;
17334 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
17335 LDKu8slice data_ref;
17336 data_ref.datalen = (*env)->GetArrayLength(env, data);
17337 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
17338 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17339 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
17340 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
17341 return (long)ret_conv;
17344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17345 LDKPeerManager this_arg_conv;
17346 this_arg_conv.inner = (void*)(this_arg & (~1));
17347 this_arg_conv.is_owned = false;
17348 PeerManager_process_events(&this_arg_conv);
17351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17352 LDKPeerManager this_arg_conv;
17353 this_arg_conv.inner = (void*)(this_arg & (~1));
17354 this_arg_conv.is_owned = false;
17355 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17356 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
17359 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) {
17360 LDKPeerManager this_arg_conv;
17361 this_arg_conv.inner = (void*)(this_arg & (~1));
17362 this_arg_conv.is_owned = false;
17363 LDKPublicKey node_id_ref;
17364 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17365 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17366 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
17369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
17370 LDKPeerManager this_arg_conv;
17371 this_arg_conv.inner = (void*)(this_arg & (~1));
17372 this_arg_conv.is_owned = false;
17373 PeerManager_timer_tick_occurred(&this_arg_conv);
17376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
17377 unsigned char commitment_seed_arr[32];
17378 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17379 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
17380 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
17381 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17382 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
17386 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) {
17387 LDKPublicKey per_commitment_point_ref;
17388 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17389 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17390 unsigned char base_secret_arr[32];
17391 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
17392 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
17393 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
17394 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17395 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
17396 return (long)ret_conv;
17399 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) {
17400 LDKPublicKey per_commitment_point_ref;
17401 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17402 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17403 LDKPublicKey base_point_ref;
17404 CHECK((*env)->GetArrayLength(env, base_point) == 33);
17405 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
17406 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17407 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
17408 return (long)ret_conv;
17411 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) {
17412 unsigned char per_commitment_secret_arr[32];
17413 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
17414 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
17415 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
17416 unsigned char countersignatory_revocation_base_secret_arr[32];
17417 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
17418 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
17419 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
17420 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17421 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
17422 return (long)ret_conv;
17425 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) {
17426 LDKPublicKey per_commitment_point_ref;
17427 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17428 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17429 LDKPublicKey countersignatory_revocation_base_point_ref;
17430 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
17431 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
17432 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17433 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
17434 return (long)ret_conv;
17437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17438 LDKTxCreationKeys this_obj_conv;
17439 this_obj_conv.inner = (void*)(this_obj & (~1));
17440 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17441 TxCreationKeys_free(this_obj_conv);
17444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17445 LDKTxCreationKeys this_ptr_conv;
17446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17447 this_ptr_conv.is_owned = false;
17448 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17449 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
17453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17454 LDKTxCreationKeys this_ptr_conv;
17455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17456 this_ptr_conv.is_owned = false;
17457 LDKPublicKey val_ref;
17458 CHECK((*env)->GetArrayLength(env, val) == 33);
17459 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17460 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
17463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17464 LDKTxCreationKeys this_ptr_conv;
17465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17466 this_ptr_conv.is_owned = false;
17467 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17473 LDKTxCreationKeys this_ptr_conv;
17474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17475 this_ptr_conv.is_owned = false;
17476 LDKPublicKey val_ref;
17477 CHECK((*env)->GetArrayLength(env, val) == 33);
17478 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17479 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
17482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17483 LDKTxCreationKeys this_ptr_conv;
17484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17485 this_ptr_conv.is_owned = false;
17486 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17487 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
17491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17492 LDKTxCreationKeys this_ptr_conv;
17493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17494 this_ptr_conv.is_owned = false;
17495 LDKPublicKey val_ref;
17496 CHECK((*env)->GetArrayLength(env, val) == 33);
17497 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17498 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
17501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17502 LDKTxCreationKeys this_ptr_conv;
17503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17504 this_ptr_conv.is_owned = false;
17505 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
17510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17511 LDKTxCreationKeys this_ptr_conv;
17512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17513 this_ptr_conv.is_owned = false;
17514 LDKPublicKey val_ref;
17515 CHECK((*env)->GetArrayLength(env, val) == 33);
17516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17517 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
17520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17521 LDKTxCreationKeys this_ptr_conv;
17522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17523 this_ptr_conv.is_owned = false;
17524 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
17529 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) {
17530 LDKTxCreationKeys this_ptr_conv;
17531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17532 this_ptr_conv.is_owned = false;
17533 LDKPublicKey val_ref;
17534 CHECK((*env)->GetArrayLength(env, val) == 33);
17535 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17536 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
17539 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) {
17540 LDKPublicKey per_commitment_point_arg_ref;
17541 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17542 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17543 LDKPublicKey revocation_key_arg_ref;
17544 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
17545 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
17546 LDKPublicKey broadcaster_htlc_key_arg_ref;
17547 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
17548 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
17549 LDKPublicKey countersignatory_htlc_key_arg_ref;
17550 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
17551 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
17552 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17553 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
17554 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
17555 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);
17556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17558 long ret_ref = (long)ret_var.inner;
17559 if (ret_var.is_owned) {
17565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17566 LDKTxCreationKeys orig_conv;
17567 orig_conv.inner = (void*)(orig & (~1));
17568 orig_conv.is_owned = false;
17569 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17572 long ret_ref = (long)ret_var.inner;
17573 if (ret_var.is_owned) {
17579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17580 LDKTxCreationKeys obj_conv;
17581 obj_conv.inner = (void*)(obj & (~1));
17582 obj_conv.is_owned = false;
17583 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17584 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17585 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17586 CVec_u8Z_free(ret_var);
17590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17591 LDKu8slice ser_ref;
17592 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17593 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17594 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17595 *ret_conv = TxCreationKeys_read(ser_ref);
17596 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17597 return (long)ret_conv;
17600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17601 LDKChannelPublicKeys this_obj_conv;
17602 this_obj_conv.inner = (void*)(this_obj & (~1));
17603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17604 ChannelPublicKeys_free(this_obj_conv);
17607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17608 LDKChannelPublicKeys this_ptr_conv;
17609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17610 this_ptr_conv.is_owned = false;
17611 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17612 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
17616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17617 LDKChannelPublicKeys this_ptr_conv;
17618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17619 this_ptr_conv.is_owned = false;
17620 LDKPublicKey val_ref;
17621 CHECK((*env)->GetArrayLength(env, val) == 33);
17622 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17623 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17627 LDKChannelPublicKeys this_ptr_conv;
17628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17629 this_ptr_conv.is_owned = false;
17630 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17636 LDKChannelPublicKeys this_ptr_conv;
17637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17638 this_ptr_conv.is_owned = false;
17639 LDKPublicKey val_ref;
17640 CHECK((*env)->GetArrayLength(env, val) == 33);
17641 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17642 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17646 LDKChannelPublicKeys this_ptr_conv;
17647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17648 this_ptr_conv.is_owned = false;
17649 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17650 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
17654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17655 LDKChannelPublicKeys this_ptr_conv;
17656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17657 this_ptr_conv.is_owned = false;
17658 LDKPublicKey val_ref;
17659 CHECK((*env)->GetArrayLength(env, val) == 33);
17660 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17661 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17665 LDKChannelPublicKeys this_ptr_conv;
17666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17667 this_ptr_conv.is_owned = false;
17668 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17669 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17674 LDKChannelPublicKeys this_ptr_conv;
17675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17676 this_ptr_conv.is_owned = false;
17677 LDKPublicKey val_ref;
17678 CHECK((*env)->GetArrayLength(env, val) == 33);
17679 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17680 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17684 LDKChannelPublicKeys this_ptr_conv;
17685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17686 this_ptr_conv.is_owned = false;
17687 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17688 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17693 LDKChannelPublicKeys this_ptr_conv;
17694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17695 this_ptr_conv.is_owned = false;
17696 LDKPublicKey val_ref;
17697 CHECK((*env)->GetArrayLength(env, val) == 33);
17698 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17699 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
17702 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) {
17703 LDKPublicKey funding_pubkey_arg_ref;
17704 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
17705 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
17706 LDKPublicKey revocation_basepoint_arg_ref;
17707 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
17708 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
17709 LDKPublicKey payment_point_arg_ref;
17710 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
17711 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
17712 LDKPublicKey delayed_payment_basepoint_arg_ref;
17713 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
17714 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
17715 LDKPublicKey htlc_basepoint_arg_ref;
17716 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
17717 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
17718 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);
17719 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17720 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17721 long ret_ref = (long)ret_var.inner;
17722 if (ret_var.is_owned) {
17728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17729 LDKChannelPublicKeys orig_conv;
17730 orig_conv.inner = (void*)(orig & (~1));
17731 orig_conv.is_owned = false;
17732 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
17733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17735 long ret_ref = (long)ret_var.inner;
17736 if (ret_var.is_owned) {
17742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17743 LDKChannelPublicKeys obj_conv;
17744 obj_conv.inner = (void*)(obj & (~1));
17745 obj_conv.is_owned = false;
17746 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
17747 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17748 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17749 CVec_u8Z_free(ret_var);
17753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17754 LDKu8slice ser_ref;
17755 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17756 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17757 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
17758 *ret_conv = ChannelPublicKeys_read(ser_ref);
17759 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17760 return (long)ret_conv;
17763 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) {
17764 LDKPublicKey per_commitment_point_ref;
17765 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17766 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17767 LDKPublicKey broadcaster_delayed_payment_base_ref;
17768 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
17769 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
17770 LDKPublicKey broadcaster_htlc_base_ref;
17771 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
17772 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
17773 LDKPublicKey countersignatory_revocation_base_ref;
17774 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
17775 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
17776 LDKPublicKey countersignatory_htlc_base_ref;
17777 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
17778 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
17779 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17780 *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);
17781 return (long)ret_conv;
17784 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) {
17785 LDKPublicKey per_commitment_point_ref;
17786 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17787 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17788 LDKChannelPublicKeys broadcaster_keys_conv;
17789 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17790 broadcaster_keys_conv.is_owned = false;
17791 LDKChannelPublicKeys countersignatory_keys_conv;
17792 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17793 countersignatory_keys_conv.is_owned = false;
17794 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17795 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
17796 return (long)ret_conv;
17799 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) {
17800 LDKPublicKey revocation_key_ref;
17801 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17802 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17803 LDKPublicKey broadcaster_delayed_payment_key_ref;
17804 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17805 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17806 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
17807 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17808 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17809 CVec_u8Z_free(ret_var);
17813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17814 LDKHTLCOutputInCommitment this_obj_conv;
17815 this_obj_conv.inner = (void*)(this_obj & (~1));
17816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17817 HTLCOutputInCommitment_free(this_obj_conv);
17820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
17821 LDKHTLCOutputInCommitment this_ptr_conv;
17822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17823 this_ptr_conv.is_owned = false;
17824 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
17828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17829 LDKHTLCOutputInCommitment this_ptr_conv;
17830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17831 this_ptr_conv.is_owned = false;
17832 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
17835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17836 LDKHTLCOutputInCommitment this_ptr_conv;
17837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17838 this_ptr_conv.is_owned = false;
17839 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
17843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17844 LDKHTLCOutputInCommitment this_ptr_conv;
17845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17846 this_ptr_conv.is_owned = false;
17847 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
17850 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17851 LDKHTLCOutputInCommitment this_ptr_conv;
17852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17853 this_ptr_conv.is_owned = false;
17854 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
17858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17859 LDKHTLCOutputInCommitment this_ptr_conv;
17860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17861 this_ptr_conv.is_owned = false;
17862 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
17865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17866 LDKHTLCOutputInCommitment this_ptr_conv;
17867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17868 this_ptr_conv.is_owned = false;
17869 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17870 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
17874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17875 LDKHTLCOutputInCommitment this_ptr_conv;
17876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17877 this_ptr_conv.is_owned = false;
17878 LDKThirtyTwoBytes val_ref;
17879 CHECK((*env)->GetArrayLength(env, val) == 32);
17880 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17881 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
17884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17885 LDKHTLCOutputInCommitment orig_conv;
17886 orig_conv.inner = (void*)(orig & (~1));
17887 orig_conv.is_owned = false;
17888 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
17889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17891 long ret_ref = (long)ret_var.inner;
17892 if (ret_var.is_owned) {
17898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
17899 LDKHTLCOutputInCommitment obj_conv;
17900 obj_conv.inner = (void*)(obj & (~1));
17901 obj_conv.is_owned = false;
17902 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
17903 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17904 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17905 CVec_u8Z_free(ret_var);
17909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17910 LDKu8slice ser_ref;
17911 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17912 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17913 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
17914 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
17915 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17916 return (long)ret_conv;
17919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
17920 LDKHTLCOutputInCommitment htlc_conv;
17921 htlc_conv.inner = (void*)(htlc & (~1));
17922 htlc_conv.is_owned = false;
17923 LDKTxCreationKeys keys_conv;
17924 keys_conv.inner = (void*)(keys & (~1));
17925 keys_conv.is_owned = false;
17926 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
17927 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17928 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17929 CVec_u8Z_free(ret_var);
17933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
17934 LDKPublicKey broadcaster_ref;
17935 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
17936 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
17937 LDKPublicKey countersignatory_ref;
17938 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
17939 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
17940 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
17941 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17942 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17943 CVec_u8Z_free(ret_var);
17947 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) {
17948 unsigned char prev_hash_arr[32];
17949 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
17950 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
17951 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
17952 LDKHTLCOutputInCommitment htlc_conv;
17953 htlc_conv.inner = (void*)(htlc & (~1));
17954 htlc_conv.is_owned = false;
17955 LDKPublicKey broadcaster_delayed_payment_key_ref;
17956 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17957 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17958 LDKPublicKey revocation_key_ref;
17959 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17960 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17961 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
17962 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17963 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17964 Transaction_free(ret_var);
17968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17969 LDKChannelTransactionParameters this_obj_conv;
17970 this_obj_conv.inner = (void*)(this_obj & (~1));
17971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17972 ChannelTransactionParameters_free(this_obj_conv);
17975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
17976 LDKChannelTransactionParameters this_ptr_conv;
17977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17978 this_ptr_conv.is_owned = false;
17979 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
17980 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17981 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17982 long ret_ref = (long)ret_var.inner;
17983 if (ret_var.is_owned) {
17989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17990 LDKChannelTransactionParameters this_ptr_conv;
17991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17992 this_ptr_conv.is_owned = false;
17993 LDKChannelPublicKeys val_conv;
17994 val_conv.inner = (void*)(val & (~1));
17995 val_conv.is_owned = (val & 1) || (val == 0);
17996 val_conv = ChannelPublicKeys_clone(&val_conv);
17997 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
18000 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18001 LDKChannelTransactionParameters this_ptr_conv;
18002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18003 this_ptr_conv.is_owned = false;
18004 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
18008 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) {
18009 LDKChannelTransactionParameters this_ptr_conv;
18010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18011 this_ptr_conv.is_owned = false;
18012 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
18015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
18016 LDKChannelTransactionParameters this_ptr_conv;
18017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18018 this_ptr_conv.is_owned = false;
18019 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
18023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18024 LDKChannelTransactionParameters this_ptr_conv;
18025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18026 this_ptr_conv.is_owned = false;
18027 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
18030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
18031 LDKChannelTransactionParameters this_ptr_conv;
18032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18033 this_ptr_conv.is_owned = false;
18034 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
18035 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18036 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18037 long ret_ref = (long)ret_var.inner;
18038 if (ret_var.is_owned) {
18044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18045 LDKChannelTransactionParameters this_ptr_conv;
18046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18047 this_ptr_conv.is_owned = false;
18048 LDKCounterpartyChannelTransactionParameters val_conv;
18049 val_conv.inner = (void*)(val & (~1));
18050 val_conv.is_owned = (val & 1) || (val == 0);
18051 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
18052 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
18055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18056 LDKChannelTransactionParameters this_ptr_conv;
18057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18058 this_ptr_conv.is_owned = false;
18059 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
18060 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18061 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18062 long ret_ref = (long)ret_var.inner;
18063 if (ret_var.is_owned) {
18069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18070 LDKChannelTransactionParameters this_ptr_conv;
18071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18072 this_ptr_conv.is_owned = false;
18073 LDKOutPoint val_conv;
18074 val_conv.inner = (void*)(val & (~1));
18075 val_conv.is_owned = (val & 1) || (val == 0);
18076 val_conv = OutPoint_clone(&val_conv);
18077 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
18080 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) {
18081 LDKChannelPublicKeys holder_pubkeys_arg_conv;
18082 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
18083 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
18084 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
18085 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
18086 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
18087 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
18088 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
18089 LDKOutPoint funding_outpoint_arg_conv;
18090 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
18091 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
18092 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
18093 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);
18094 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18095 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18096 long ret_ref = (long)ret_var.inner;
18097 if (ret_var.is_owned) {
18103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18104 LDKChannelTransactionParameters orig_conv;
18105 orig_conv.inner = (void*)(orig & (~1));
18106 orig_conv.is_owned = false;
18107 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
18108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18110 long ret_ref = (long)ret_var.inner;
18111 if (ret_var.is_owned) {
18117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18118 LDKCounterpartyChannelTransactionParameters this_obj_conv;
18119 this_obj_conv.inner = (void*)(this_obj & (~1));
18120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18121 CounterpartyChannelTransactionParameters_free(this_obj_conv);
18124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
18125 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18127 this_ptr_conv.is_owned = false;
18128 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
18129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18131 long ret_ref = (long)ret_var.inner;
18132 if (ret_var.is_owned) {
18138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18139 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18141 this_ptr_conv.is_owned = false;
18142 LDKChannelPublicKeys val_conv;
18143 val_conv.inner = (void*)(val & (~1));
18144 val_conv.is_owned = (val & 1) || (val == 0);
18145 val_conv = ChannelPublicKeys_clone(&val_conv);
18146 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
18149 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18150 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18152 this_ptr_conv.is_owned = false;
18153 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
18157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18158 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18160 this_ptr_conv.is_owned = false;
18161 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
18164 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) {
18165 LDKChannelPublicKeys pubkeys_arg_conv;
18166 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
18167 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
18168 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
18169 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
18170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18172 long ret_ref = (long)ret_var.inner;
18173 if (ret_var.is_owned) {
18179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18180 LDKCounterpartyChannelTransactionParameters orig_conv;
18181 orig_conv.inner = (void*)(orig & (~1));
18182 orig_conv.is_owned = false;
18183 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
18184 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18185 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18186 long ret_ref = (long)ret_var.inner;
18187 if (ret_var.is_owned) {
18193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
18194 LDKChannelTransactionParameters this_arg_conv;
18195 this_arg_conv.inner = (void*)(this_arg & (~1));
18196 this_arg_conv.is_owned = false;
18197 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
18201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18202 LDKChannelTransactionParameters this_arg_conv;
18203 this_arg_conv.inner = (void*)(this_arg & (~1));
18204 this_arg_conv.is_owned = false;
18205 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
18206 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18207 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18208 long ret_ref = (long)ret_var.inner;
18209 if (ret_var.is_owned) {
18215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18216 LDKChannelTransactionParameters this_arg_conv;
18217 this_arg_conv.inner = (void*)(this_arg & (~1));
18218 this_arg_conv.is_owned = false;
18219 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
18220 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18221 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18222 long ret_ref = (long)ret_var.inner;
18223 if (ret_var.is_owned) {
18229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18230 LDKCounterpartyChannelTransactionParameters obj_conv;
18231 obj_conv.inner = (void*)(obj & (~1));
18232 obj_conv.is_owned = false;
18233 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
18234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18236 CVec_u8Z_free(ret_var);
18240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18241 LDKu8slice ser_ref;
18242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18244 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
18245 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
18246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18247 return (long)ret_conv;
18250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18251 LDKChannelTransactionParameters obj_conv;
18252 obj_conv.inner = (void*)(obj & (~1));
18253 obj_conv.is_owned = false;
18254 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
18255 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18256 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18257 CVec_u8Z_free(ret_var);
18261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18262 LDKu8slice ser_ref;
18263 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18264 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18265 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
18266 *ret_conv = ChannelTransactionParameters_read(ser_ref);
18267 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18268 return (long)ret_conv;
18271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18272 LDKDirectedChannelTransactionParameters this_obj_conv;
18273 this_obj_conv.inner = (void*)(this_obj & (~1));
18274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18275 DirectedChannelTransactionParameters_free(this_obj_conv);
18278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18279 LDKDirectedChannelTransactionParameters this_arg_conv;
18280 this_arg_conv.inner = (void*)(this_arg & (~1));
18281 this_arg_conv.is_owned = false;
18282 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
18283 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18284 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18285 long ret_ref = (long)ret_var.inner;
18286 if (ret_var.is_owned) {
18292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18293 LDKDirectedChannelTransactionParameters this_arg_conv;
18294 this_arg_conv.inner = (void*)(this_arg & (~1));
18295 this_arg_conv.is_owned = false;
18296 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
18297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18299 long ret_ref = (long)ret_var.inner;
18300 if (ret_var.is_owned) {
18306 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18307 LDKDirectedChannelTransactionParameters this_arg_conv;
18308 this_arg_conv.inner = (void*)(this_arg & (~1));
18309 this_arg_conv.is_owned = false;
18310 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
18314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
18315 LDKDirectedChannelTransactionParameters this_arg_conv;
18316 this_arg_conv.inner = (void*)(this_arg & (~1));
18317 this_arg_conv.is_owned = false;
18318 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
18322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
18323 LDKDirectedChannelTransactionParameters this_arg_conv;
18324 this_arg_conv.inner = (void*)(this_arg & (~1));
18325 this_arg_conv.is_owned = false;
18326 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
18327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18329 long ret_ref = (long)ret_var.inner;
18330 if (ret_var.is_owned) {
18336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18337 LDKHolderCommitmentTransaction this_obj_conv;
18338 this_obj_conv.inner = (void*)(this_obj & (~1));
18339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18340 HolderCommitmentTransaction_free(this_obj_conv);
18343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
18344 LDKHolderCommitmentTransaction this_ptr_conv;
18345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18346 this_ptr_conv.is_owned = false;
18347 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18348 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
18352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18353 LDKHolderCommitmentTransaction this_ptr_conv;
18354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18355 this_ptr_conv.is_owned = false;
18356 LDKSignature val_ref;
18357 CHECK((*env)->GetArrayLength(env, val) == 64);
18358 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18359 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
18362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18363 LDKHolderCommitmentTransaction this_ptr_conv;
18364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18365 this_ptr_conv.is_owned = false;
18366 LDKCVec_SignatureZ val_constr;
18367 val_constr.datalen = (*env)->GetArrayLength(env, val);
18368 if (val_constr.datalen > 0)
18369 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18371 val_constr.data = NULL;
18372 for (size_t i = 0; i < val_constr.datalen; i++) {
18373 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18374 LDKSignature val_conv_8_ref;
18375 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18376 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18377 val_constr.data[i] = val_conv_8_ref;
18379 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
18382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18383 LDKHolderCommitmentTransaction orig_conv;
18384 orig_conv.inner = (void*)(orig & (~1));
18385 orig_conv.is_owned = false;
18386 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
18387 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18388 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18389 long ret_ref = (long)ret_var.inner;
18390 if (ret_var.is_owned) {
18396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18397 LDKHolderCommitmentTransaction obj_conv;
18398 obj_conv.inner = (void*)(obj & (~1));
18399 obj_conv.is_owned = false;
18400 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
18401 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18402 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18403 CVec_u8Z_free(ret_var);
18407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18408 LDKu8slice ser_ref;
18409 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18410 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18411 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
18412 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
18413 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18414 return (long)ret_conv;
18417 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) {
18418 LDKCommitmentTransaction commitment_tx_conv;
18419 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
18420 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
18421 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
18422 LDKSignature counterparty_sig_ref;
18423 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
18424 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
18425 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
18426 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
18427 if (counterparty_htlc_sigs_constr.datalen > 0)
18428 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18430 counterparty_htlc_sigs_constr.data = NULL;
18431 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
18432 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
18433 LDKSignature counterparty_htlc_sigs_conv_8_ref;
18434 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
18435 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
18436 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
18438 LDKPublicKey holder_funding_key_ref;
18439 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
18440 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
18441 LDKPublicKey counterparty_funding_key_ref;
18442 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
18443 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
18444 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
18445 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18446 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18447 long ret_ref = (long)ret_var.inner;
18448 if (ret_var.is_owned) {
18454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18455 LDKBuiltCommitmentTransaction this_obj_conv;
18456 this_obj_conv.inner = (void*)(this_obj & (~1));
18457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18458 BuiltCommitmentTransaction_free(this_obj_conv);
18461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
18462 LDKBuiltCommitmentTransaction this_ptr_conv;
18463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18464 this_ptr_conv.is_owned = false;
18465 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
18466 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18467 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18468 Transaction_free(ret_var);
18472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18473 LDKBuiltCommitmentTransaction this_ptr_conv;
18474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18475 this_ptr_conv.is_owned = false;
18476 LDKTransaction val_ref;
18477 val_ref.datalen = (*env)->GetArrayLength(env, val);
18478 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
18479 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18480 val_ref.data_is_owned = true;
18481 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
18484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18485 LDKBuiltCommitmentTransaction this_ptr_conv;
18486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18487 this_ptr_conv.is_owned = false;
18488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
18493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18494 LDKBuiltCommitmentTransaction this_ptr_conv;
18495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18496 this_ptr_conv.is_owned = false;
18497 LDKThirtyTwoBytes val_ref;
18498 CHECK((*env)->GetArrayLength(env, val) == 32);
18499 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18500 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
18503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
18504 LDKTransaction transaction_arg_ref;
18505 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
18506 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
18507 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
18508 transaction_arg_ref.data_is_owned = true;
18509 LDKThirtyTwoBytes txid_arg_ref;
18510 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
18511 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
18512 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18515 long ret_ref = (long)ret_var.inner;
18516 if (ret_var.is_owned) {
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18523 LDKBuiltCommitmentTransaction orig_conv;
18524 orig_conv.inner = (void*)(orig & (~1));
18525 orig_conv.is_owned = false;
18526 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18529 long ret_ref = (long)ret_var.inner;
18530 if (ret_var.is_owned) {
18536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18537 LDKBuiltCommitmentTransaction obj_conv;
18538 obj_conv.inner = (void*)(obj & (~1));
18539 obj_conv.is_owned = false;
18540 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18541 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18542 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18543 CVec_u8Z_free(ret_var);
18547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18548 LDKu8slice ser_ref;
18549 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18550 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18551 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18552 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18553 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18554 return (long)ret_conv;
18557 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) {
18558 LDKBuiltCommitmentTransaction this_arg_conv;
18559 this_arg_conv.inner = (void*)(this_arg & (~1));
18560 this_arg_conv.is_owned = false;
18561 LDKu8slice funding_redeemscript_ref;
18562 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18563 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18564 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18565 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
18566 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18570 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) {
18571 LDKBuiltCommitmentTransaction this_arg_conv;
18572 this_arg_conv.inner = (void*)(this_arg & (~1));
18573 this_arg_conv.is_owned = false;
18574 unsigned char funding_key_arr[32];
18575 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18576 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
18577 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18578 LDKu8slice funding_redeemscript_ref;
18579 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18580 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18581 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18582 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
18583 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18588 LDKCommitmentTransaction this_obj_conv;
18589 this_obj_conv.inner = (void*)(this_obj & (~1));
18590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18591 CommitmentTransaction_free(this_obj_conv);
18594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18595 LDKCommitmentTransaction orig_conv;
18596 orig_conv.inner = (void*)(orig & (~1));
18597 orig_conv.is_owned = false;
18598 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
18599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18601 long ret_ref = (long)ret_var.inner;
18602 if (ret_var.is_owned) {
18608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18609 LDKCommitmentTransaction obj_conv;
18610 obj_conv.inner = (void*)(obj & (~1));
18611 obj_conv.is_owned = false;
18612 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
18613 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18614 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18615 CVec_u8Z_free(ret_var);
18619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18620 LDKu8slice ser_ref;
18621 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18622 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18623 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18624 *ret_conv = CommitmentTransaction_read(ser_ref);
18625 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18626 return (long)ret_conv;
18629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
18630 LDKCommitmentTransaction this_arg_conv;
18631 this_arg_conv.inner = (void*)(this_arg & (~1));
18632 this_arg_conv.is_owned = false;
18633 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18638 LDKCommitmentTransaction this_arg_conv;
18639 this_arg_conv.inner = (void*)(this_arg & (~1));
18640 this_arg_conv.is_owned = false;
18641 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
18645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18646 LDKCommitmentTransaction this_arg_conv;
18647 this_arg_conv.inner = (void*)(this_arg & (~1));
18648 this_arg_conv.is_owned = false;
18649 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
18653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
18654 LDKCommitmentTransaction this_arg_conv;
18655 this_arg_conv.inner = (void*)(this_arg & (~1));
18656 this_arg_conv.is_owned = false;
18657 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
18661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
18662 LDKCommitmentTransaction this_arg_conv;
18663 this_arg_conv.inner = (void*)(this_arg & (~1));
18664 this_arg_conv.is_owned = false;
18665 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
18666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18668 long ret_ref = (long)ret_var.inner;
18669 if (ret_var.is_owned) {
18675 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) {
18676 LDKCommitmentTransaction this_arg_conv;
18677 this_arg_conv.inner = (void*)(this_arg & (~1));
18678 this_arg_conv.is_owned = false;
18679 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18680 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18681 channel_parameters_conv.is_owned = false;
18682 LDKChannelPublicKeys broadcaster_keys_conv;
18683 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18684 broadcaster_keys_conv.is_owned = false;
18685 LDKChannelPublicKeys countersignatory_keys_conv;
18686 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18687 countersignatory_keys_conv.is_owned = false;
18688 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
18689 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
18690 return (long)ret_conv;
18693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18694 LDKTrustedCommitmentTransaction this_obj_conv;
18695 this_obj_conv.inner = (void*)(this_obj & (~1));
18696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18697 TrustedCommitmentTransaction_free(this_obj_conv);
18700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
18701 LDKTrustedCommitmentTransaction this_arg_conv;
18702 this_arg_conv.inner = (void*)(this_arg & (~1));
18703 this_arg_conv.is_owned = false;
18704 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18705 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
18709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
18710 LDKTrustedCommitmentTransaction this_arg_conv;
18711 this_arg_conv.inner = (void*)(this_arg & (~1));
18712 this_arg_conv.is_owned = false;
18713 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
18714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18716 long ret_ref = (long)ret_var.inner;
18717 if (ret_var.is_owned) {
18723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
18724 LDKTrustedCommitmentTransaction this_arg_conv;
18725 this_arg_conv.inner = (void*)(this_arg & (~1));
18726 this_arg_conv.is_owned = false;
18727 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
18728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18730 long ret_ref = (long)ret_var.inner;
18731 if (ret_var.is_owned) {
18737 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) {
18738 LDKTrustedCommitmentTransaction this_arg_conv;
18739 this_arg_conv.inner = (void*)(this_arg & (~1));
18740 this_arg_conv.is_owned = false;
18741 unsigned char htlc_base_key_arr[32];
18742 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
18743 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
18744 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
18745 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18746 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18747 channel_parameters_conv.is_owned = false;
18748 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
18749 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
18750 return (long)ret_conv;
18753 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) {
18754 LDKPublicKey broadcaster_payment_basepoint_ref;
18755 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
18756 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
18757 LDKPublicKey countersignatory_payment_basepoint_ref;
18758 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
18759 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
18760 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
18764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18765 LDKInitFeatures orig_conv;
18766 orig_conv.inner = (void*)(orig & (~1));
18767 orig_conv.is_owned = false;
18768 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
18769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18771 long ret_ref = (long)ret_var.inner;
18772 if (ret_var.is_owned) {
18778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18779 LDKNodeFeatures orig_conv;
18780 orig_conv.inner = (void*)(orig & (~1));
18781 orig_conv.is_owned = false;
18782 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
18783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18785 long ret_ref = (long)ret_var.inner;
18786 if (ret_var.is_owned) {
18792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18793 LDKChannelFeatures orig_conv;
18794 orig_conv.inner = (void*)(orig & (~1));
18795 orig_conv.is_owned = false;
18796 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
18797 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18798 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18799 long ret_ref = (long)ret_var.inner;
18800 if (ret_var.is_owned) {
18806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18807 LDKInvoiceFeatures orig_conv;
18808 orig_conv.inner = (void*)(orig & (~1));
18809 orig_conv.is_owned = false;
18810 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
18811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18813 long ret_ref = (long)ret_var.inner;
18814 if (ret_var.is_owned) {
18820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18821 LDKInitFeatures this_obj_conv;
18822 this_obj_conv.inner = (void*)(this_obj & (~1));
18823 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18824 InitFeatures_free(this_obj_conv);
18827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18828 LDKNodeFeatures this_obj_conv;
18829 this_obj_conv.inner = (void*)(this_obj & (~1));
18830 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18831 NodeFeatures_free(this_obj_conv);
18834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18835 LDKChannelFeatures this_obj_conv;
18836 this_obj_conv.inner = (void*)(this_obj & (~1));
18837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18838 ChannelFeatures_free(this_obj_conv);
18841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18842 LDKInvoiceFeatures this_obj_conv;
18843 this_obj_conv.inner = (void*)(this_obj & (~1));
18844 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18845 InvoiceFeatures_free(this_obj_conv);
18848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
18849 LDKInitFeatures ret_var = InitFeatures_empty();
18850 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18851 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18852 long ret_ref = (long)ret_var.inner;
18853 if (ret_var.is_owned) {
18859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
18860 LDKInitFeatures ret_var = InitFeatures_known();
18861 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18862 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18863 long ret_ref = (long)ret_var.inner;
18864 if (ret_var.is_owned) {
18870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
18871 LDKNodeFeatures ret_var = NodeFeatures_empty();
18872 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18873 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18874 long ret_ref = (long)ret_var.inner;
18875 if (ret_var.is_owned) {
18881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
18882 LDKNodeFeatures ret_var = NodeFeatures_known();
18883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18885 long ret_ref = (long)ret_var.inner;
18886 if (ret_var.is_owned) {
18892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
18893 LDKChannelFeatures ret_var = ChannelFeatures_empty();
18894 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18895 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18896 long ret_ref = (long)ret_var.inner;
18897 if (ret_var.is_owned) {
18903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
18904 LDKChannelFeatures ret_var = ChannelFeatures_known();
18905 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18906 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18907 long ret_ref = (long)ret_var.inner;
18908 if (ret_var.is_owned) {
18914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
18915 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
18916 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18917 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18918 long ret_ref = (long)ret_var.inner;
18919 if (ret_var.is_owned) {
18925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
18926 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
18927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18929 long ret_ref = (long)ret_var.inner;
18930 if (ret_var.is_owned) {
18936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18937 LDKInitFeatures obj_conv;
18938 obj_conv.inner = (void*)(obj & (~1));
18939 obj_conv.is_owned = false;
18940 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
18941 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18942 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18943 CVec_u8Z_free(ret_var);
18947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18948 LDKNodeFeatures obj_conv;
18949 obj_conv.inner = (void*)(obj & (~1));
18950 obj_conv.is_owned = false;
18951 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
18952 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18953 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18954 CVec_u8Z_free(ret_var);
18958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18959 LDKChannelFeatures obj_conv;
18960 obj_conv.inner = (void*)(obj & (~1));
18961 obj_conv.is_owned = false;
18962 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
18963 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18964 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18965 CVec_u8Z_free(ret_var);
18969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18970 LDKInvoiceFeatures obj_conv;
18971 obj_conv.inner = (void*)(obj & (~1));
18972 obj_conv.is_owned = false;
18973 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
18974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18976 CVec_u8Z_free(ret_var);
18980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18981 LDKu8slice ser_ref;
18982 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18983 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18984 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18985 *ret_conv = InitFeatures_read(ser_ref);
18986 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18987 return (long)ret_conv;
18990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18991 LDKu8slice ser_ref;
18992 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18993 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18994 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18995 *ret_conv = NodeFeatures_read(ser_ref);
18996 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18997 return (long)ret_conv;
19000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19001 LDKu8slice ser_ref;
19002 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19003 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19004 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
19005 *ret_conv = ChannelFeatures_read(ser_ref);
19006 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19007 return (long)ret_conv;
19010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19011 LDKu8slice ser_ref;
19012 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19013 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19014 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
19015 *ret_conv = InvoiceFeatures_read(ser_ref);
19016 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19017 return (long)ret_conv;
19020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19021 LDKRouteHop this_obj_conv;
19022 this_obj_conv.inner = (void*)(this_obj & (~1));
19023 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19024 RouteHop_free(this_obj_conv);
19027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19028 LDKRouteHop this_ptr_conv;
19029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19030 this_ptr_conv.is_owned = false;
19031 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
19036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19037 LDKRouteHop this_ptr_conv;
19038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19039 this_ptr_conv.is_owned = false;
19040 LDKPublicKey val_ref;
19041 CHECK((*env)->GetArrayLength(env, val) == 33);
19042 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19043 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
19046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19047 LDKRouteHop this_ptr_conv;
19048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19049 this_ptr_conv.is_owned = false;
19050 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
19051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19053 long ret_ref = (long)ret_var.inner;
19054 if (ret_var.is_owned) {
19060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19061 LDKRouteHop this_ptr_conv;
19062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19063 this_ptr_conv.is_owned = false;
19064 LDKNodeFeatures val_conv;
19065 val_conv.inner = (void*)(val & (~1));
19066 val_conv.is_owned = (val & 1) || (val == 0);
19067 val_conv = NodeFeatures_clone(&val_conv);
19068 RouteHop_set_node_features(&this_ptr_conv, val_conv);
19071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19072 LDKRouteHop this_ptr_conv;
19073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19074 this_ptr_conv.is_owned = false;
19075 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
19079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19080 LDKRouteHop this_ptr_conv;
19081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19082 this_ptr_conv.is_owned = false;
19083 RouteHop_set_short_channel_id(&this_ptr_conv, val);
19086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19087 LDKRouteHop this_ptr_conv;
19088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19089 this_ptr_conv.is_owned = false;
19090 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
19091 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19092 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19093 long ret_ref = (long)ret_var.inner;
19094 if (ret_var.is_owned) {
19100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19101 LDKRouteHop this_ptr_conv;
19102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19103 this_ptr_conv.is_owned = false;
19104 LDKChannelFeatures val_conv;
19105 val_conv.inner = (void*)(val & (~1));
19106 val_conv.is_owned = (val & 1) || (val == 0);
19107 val_conv = ChannelFeatures_clone(&val_conv);
19108 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
19111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19112 LDKRouteHop this_ptr_conv;
19113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19114 this_ptr_conv.is_owned = false;
19115 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
19119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19120 LDKRouteHop this_ptr_conv;
19121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19122 this_ptr_conv.is_owned = false;
19123 RouteHop_set_fee_msat(&this_ptr_conv, val);
19126 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19127 LDKRouteHop this_ptr_conv;
19128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19129 this_ptr_conv.is_owned = false;
19130 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
19134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19135 LDKRouteHop this_ptr_conv;
19136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19137 this_ptr_conv.is_owned = false;
19138 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
19141 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) {
19142 LDKPublicKey pubkey_arg_ref;
19143 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
19144 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
19145 LDKNodeFeatures node_features_arg_conv;
19146 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
19147 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
19148 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
19149 LDKChannelFeatures channel_features_arg_conv;
19150 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
19151 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
19152 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
19153 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);
19154 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19155 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19156 long ret_ref = (long)ret_var.inner;
19157 if (ret_var.is_owned) {
19163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19164 LDKRouteHop orig_conv;
19165 orig_conv.inner = (void*)(orig & (~1));
19166 orig_conv.is_owned = false;
19167 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
19168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19170 long ret_ref = (long)ret_var.inner;
19171 if (ret_var.is_owned) {
19177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19178 LDKRoute this_obj_conv;
19179 this_obj_conv.inner = (void*)(this_obj & (~1));
19180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19181 Route_free(this_obj_conv);
19184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
19185 LDKRoute this_ptr_conv;
19186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19187 this_ptr_conv.is_owned = false;
19188 LDKCVec_CVec_RouteHopZZ val_constr;
19189 val_constr.datalen = (*env)->GetArrayLength(env, val);
19190 if (val_constr.datalen > 0)
19191 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19193 val_constr.data = NULL;
19194 for (size_t m = 0; m < val_constr.datalen; m++) {
19195 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
19196 LDKCVec_RouteHopZ val_conv_12_constr;
19197 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
19198 if (val_conv_12_constr.datalen > 0)
19199 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19201 val_conv_12_constr.data = NULL;
19202 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
19203 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
19204 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
19205 LDKRouteHop val_conv_12_conv_10_conv;
19206 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
19207 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
19208 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
19209 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
19211 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
19212 val_constr.data[m] = val_conv_12_constr;
19214 Route_set_paths(&this_ptr_conv, val_constr);
19217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
19218 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
19219 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
19220 if (paths_arg_constr.datalen > 0)
19221 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19223 paths_arg_constr.data = NULL;
19224 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
19225 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
19226 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
19227 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
19228 if (paths_arg_conv_12_constr.datalen > 0)
19229 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19231 paths_arg_conv_12_constr.data = NULL;
19232 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
19233 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
19234 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
19235 LDKRouteHop paths_arg_conv_12_conv_10_conv;
19236 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
19237 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
19238 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
19239 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
19241 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
19242 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
19244 LDKRoute ret_var = Route_new(paths_arg_constr);
19245 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19246 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19247 long ret_ref = (long)ret_var.inner;
19248 if (ret_var.is_owned) {
19254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19255 LDKRoute orig_conv;
19256 orig_conv.inner = (void*)(orig & (~1));
19257 orig_conv.is_owned = false;
19258 LDKRoute ret_var = Route_clone(&orig_conv);
19259 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19260 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19261 long ret_ref = (long)ret_var.inner;
19262 if (ret_var.is_owned) {
19268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
19270 obj_conv.inner = (void*)(obj & (~1));
19271 obj_conv.is_owned = false;
19272 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
19273 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19274 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19275 CVec_u8Z_free(ret_var);
19279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19280 LDKu8slice ser_ref;
19281 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19282 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19283 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19284 *ret_conv = Route_read(ser_ref);
19285 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19286 return (long)ret_conv;
19289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19290 LDKRouteHint this_obj_conv;
19291 this_obj_conv.inner = (void*)(this_obj & (~1));
19292 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19293 RouteHint_free(this_obj_conv);
19296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19297 LDKRouteHint this_ptr_conv;
19298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19299 this_ptr_conv.is_owned = false;
19300 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19301 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
19305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19306 LDKRouteHint this_ptr_conv;
19307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19308 this_ptr_conv.is_owned = false;
19309 LDKPublicKey val_ref;
19310 CHECK((*env)->GetArrayLength(env, val) == 33);
19311 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19312 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
19315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19316 LDKRouteHint this_ptr_conv;
19317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19318 this_ptr_conv.is_owned = false;
19319 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
19323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19324 LDKRouteHint this_ptr_conv;
19325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19326 this_ptr_conv.is_owned = false;
19327 RouteHint_set_short_channel_id(&this_ptr_conv, val);
19330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19331 LDKRouteHint this_ptr_conv;
19332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19333 this_ptr_conv.is_owned = false;
19334 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
19335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19337 long ret_ref = (long)ret_var.inner;
19338 if (ret_var.is_owned) {
19344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19345 LDKRouteHint this_ptr_conv;
19346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19347 this_ptr_conv.is_owned = false;
19348 LDKRoutingFees val_conv;
19349 val_conv.inner = (void*)(val & (~1));
19350 val_conv.is_owned = (val & 1) || (val == 0);
19351 val_conv = RoutingFees_clone(&val_conv);
19352 RouteHint_set_fees(&this_ptr_conv, val_conv);
19355 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19356 LDKRouteHint this_ptr_conv;
19357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19358 this_ptr_conv.is_owned = false;
19359 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
19363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19364 LDKRouteHint this_ptr_conv;
19365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19366 this_ptr_conv.is_owned = false;
19367 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
19370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19371 LDKRouteHint orig_conv;
19372 orig_conv.inner = (void*)(orig & (~1));
19373 orig_conv.is_owned = false;
19374 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
19375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19377 long ret_ref = (long)ret_var.inner;
19378 if (ret_var.is_owned) {
19384 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_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
19385 LDKPublicKey our_node_id_ref;
19386 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
19387 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
19388 LDKNetworkGraph network_conv;
19389 network_conv.inner = (void*)(network & (~1));
19390 network_conv.is_owned = false;
19391 LDKPublicKey payee_ref;
19392 CHECK((*env)->GetArrayLength(env, payee) == 33);
19393 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
19394 LDKInvoiceFeatures payee_features_conv;
19395 payee_features_conv.inner = (void*)(payee_features & (~1));
19396 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
19397 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
19398 LDKCVec_ChannelDetailsZ first_hops_constr;
19399 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
19400 if (first_hops_constr.datalen > 0)
19401 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
19403 first_hops_constr.data = NULL;
19404 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
19405 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
19406 int64_t first_hops_conv_16 = first_hops_vals[q];
19407 LDKChannelDetails first_hops_conv_16_conv;
19408 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
19409 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
19410 first_hops_constr.data[q] = first_hops_conv_16_conv;
19412 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
19413 LDKCVec_RouteHintZ last_hops_constr;
19414 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
19415 if (last_hops_constr.datalen > 0)
19416 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19418 last_hops_constr.data = NULL;
19419 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
19420 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
19421 int64_t last_hops_conv_11 = last_hops_vals[l];
19422 LDKRouteHint last_hops_conv_11_conv;
19423 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
19424 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
19425 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
19426 last_hops_constr.data[l] = last_hops_conv_11_conv;
19428 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
19429 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19430 if (logger_conv.free == LDKLogger_JCalls_free) {
19431 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19432 LDKLogger_JCalls_clone(logger_conv.this_arg);
19434 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
19435 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
19436 FREE(first_hops_constr.data);
19437 return (long)ret_conv;
19440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19441 LDKNetworkGraph this_obj_conv;
19442 this_obj_conv.inner = (void*)(this_obj & (~1));
19443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19444 NetworkGraph_free(this_obj_conv);
19447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19448 LDKNetworkGraph orig_conv;
19449 orig_conv.inner = (void*)(orig & (~1));
19450 orig_conv.is_owned = false;
19451 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
19452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19454 long ret_ref = (long)ret_var.inner;
19455 if (ret_var.is_owned) {
19461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19462 LDKLockedNetworkGraph this_obj_conv;
19463 this_obj_conv.inner = (void*)(this_obj & (~1));
19464 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19465 LockedNetworkGraph_free(this_obj_conv);
19468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19469 LDKNetGraphMsgHandler this_obj_conv;
19470 this_obj_conv.inner = (void*)(this_obj & (~1));
19471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19472 NetGraphMsgHandler_free(this_obj_conv);
19475 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) {
19476 LDKThirtyTwoBytes genesis_hash_ref;
19477 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19478 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19479 LDKAccess *chain_access_conv_ptr = NULL;
19480 if (chain_access != 0) {
19481 LDKAccess chain_access_conv;
19482 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19483 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19484 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19485 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19487 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19488 *chain_access_conv_ptr = chain_access_conv;
19490 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19491 if (logger_conv.free == LDKLogger_JCalls_free) {
19492 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19493 LDKLogger_JCalls_clone(logger_conv.this_arg);
19495 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
19496 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19497 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19498 long ret_ref = (long)ret_var.inner;
19499 if (ret_var.is_owned) {
19505 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) {
19506 LDKAccess *chain_access_conv_ptr = NULL;
19507 if (chain_access != 0) {
19508 LDKAccess chain_access_conv;
19509 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19510 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19511 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19512 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19514 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19515 *chain_access_conv_ptr = chain_access_conv;
19517 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19518 if (logger_conv.free == LDKLogger_JCalls_free) {
19519 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19520 LDKLogger_JCalls_clone(logger_conv.this_arg);
19522 LDKNetworkGraph network_graph_conv;
19523 network_graph_conv.inner = (void*)(network_graph & (~1));
19524 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19525 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19526 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
19527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19529 long ret_ref = (long)ret_var.inner;
19530 if (ret_var.is_owned) {
19536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
19537 LDKNetGraphMsgHandler this_arg_conv;
19538 this_arg_conv.inner = (void*)(this_arg & (~1));
19539 this_arg_conv.is_owned = false;
19540 LDKAccess *chain_access_conv_ptr = NULL;
19541 if (chain_access != 0) {
19542 LDKAccess chain_access_conv;
19543 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19544 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19545 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19546 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19548 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19549 *chain_access_conv_ptr = chain_access_conv;
19551 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
19554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19555 LDKNetGraphMsgHandler this_arg_conv;
19556 this_arg_conv.inner = (void*)(this_arg & (~1));
19557 this_arg_conv.is_owned = false;
19558 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19561 long ret_ref = (long)ret_var.inner;
19562 if (ret_var.is_owned) {
19568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19569 LDKLockedNetworkGraph this_arg_conv;
19570 this_arg_conv.inner = (void*)(this_arg & (~1));
19571 this_arg_conv.is_owned = false;
19572 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19575 long ret_ref = (long)ret_var.inner;
19576 if (ret_var.is_owned) {
19582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
19583 LDKNetGraphMsgHandler this_arg_conv;
19584 this_arg_conv.inner = (void*)(this_arg & (~1));
19585 this_arg_conv.is_owned = false;
19586 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19587 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
19591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19592 LDKNetGraphMsgHandler this_arg_conv;
19593 this_arg_conv.inner = (void*)(this_arg & (~1));
19594 this_arg_conv.is_owned = false;
19595 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19596 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
19600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19601 LDKDirectionalChannelInfo this_obj_conv;
19602 this_obj_conv.inner = (void*)(this_obj & (~1));
19603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19604 DirectionalChannelInfo_free(this_obj_conv);
19607 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
19608 LDKDirectionalChannelInfo this_ptr_conv;
19609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19610 this_ptr_conv.is_owned = false;
19611 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
19615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19616 LDKDirectionalChannelInfo this_ptr_conv;
19617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19618 this_ptr_conv.is_owned = false;
19619 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
19622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
19623 LDKDirectionalChannelInfo this_ptr_conv;
19624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19625 this_ptr_conv.is_owned = false;
19626 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
19630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19631 LDKDirectionalChannelInfo this_ptr_conv;
19632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19633 this_ptr_conv.is_owned = false;
19634 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
19637 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19638 LDKDirectionalChannelInfo this_ptr_conv;
19639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19640 this_ptr_conv.is_owned = false;
19641 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
19645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19646 LDKDirectionalChannelInfo this_ptr_conv;
19647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19648 this_ptr_conv.is_owned = false;
19649 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19653 LDKDirectionalChannelInfo this_ptr_conv;
19654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19655 this_ptr_conv.is_owned = false;
19656 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
19660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19661 LDKDirectionalChannelInfo this_ptr_conv;
19662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19663 this_ptr_conv.is_owned = false;
19664 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
19667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19668 LDKDirectionalChannelInfo this_ptr_conv;
19669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19670 this_ptr_conv.is_owned = false;
19671 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
19672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19674 long ret_ref = (long)ret_var.inner;
19675 if (ret_var.is_owned) {
19681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19682 LDKDirectionalChannelInfo this_ptr_conv;
19683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19684 this_ptr_conv.is_owned = false;
19685 LDKRoutingFees val_conv;
19686 val_conv.inner = (void*)(val & (~1));
19687 val_conv.is_owned = (val & 1) || (val == 0);
19688 val_conv = RoutingFees_clone(&val_conv);
19689 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
19692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19693 LDKDirectionalChannelInfo this_ptr_conv;
19694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19695 this_ptr_conv.is_owned = false;
19696 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
19697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19699 long ret_ref = (long)ret_var.inner;
19700 if (ret_var.is_owned) {
19706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19707 LDKDirectionalChannelInfo this_ptr_conv;
19708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19709 this_ptr_conv.is_owned = false;
19710 LDKChannelUpdate val_conv;
19711 val_conv.inner = (void*)(val & (~1));
19712 val_conv.is_owned = (val & 1) || (val == 0);
19713 val_conv = ChannelUpdate_clone(&val_conv);
19714 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
19717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19718 LDKDirectionalChannelInfo orig_conv;
19719 orig_conv.inner = (void*)(orig & (~1));
19720 orig_conv.is_owned = false;
19721 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
19722 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19723 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19724 long ret_ref = (long)ret_var.inner;
19725 if (ret_var.is_owned) {
19731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19732 LDKDirectionalChannelInfo obj_conv;
19733 obj_conv.inner = (void*)(obj & (~1));
19734 obj_conv.is_owned = false;
19735 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
19736 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19737 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19738 CVec_u8Z_free(ret_var);
19742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19743 LDKu8slice ser_ref;
19744 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19745 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19746 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19747 *ret_conv = DirectionalChannelInfo_read(ser_ref);
19748 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19749 return (long)ret_conv;
19752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19753 LDKChannelInfo this_obj_conv;
19754 this_obj_conv.inner = (void*)(this_obj & (~1));
19755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19756 ChannelInfo_free(this_obj_conv);
19759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19760 LDKChannelInfo this_ptr_conv;
19761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19762 this_ptr_conv.is_owned = false;
19763 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
19764 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19765 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19766 long ret_ref = (long)ret_var.inner;
19767 if (ret_var.is_owned) {
19773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19774 LDKChannelInfo this_ptr_conv;
19775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19776 this_ptr_conv.is_owned = false;
19777 LDKChannelFeatures val_conv;
19778 val_conv.inner = (void*)(val & (~1));
19779 val_conv.is_owned = (val & 1) || (val == 0);
19780 val_conv = ChannelFeatures_clone(&val_conv);
19781 ChannelInfo_set_features(&this_ptr_conv, val_conv);
19784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19785 LDKChannelInfo this_ptr_conv;
19786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19787 this_ptr_conv.is_owned = false;
19788 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
19793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19794 LDKChannelInfo this_ptr_conv;
19795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19796 this_ptr_conv.is_owned = false;
19797 LDKPublicKey val_ref;
19798 CHECK((*env)->GetArrayLength(env, val) == 33);
19799 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19800 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
19803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19804 LDKChannelInfo this_ptr_conv;
19805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19806 this_ptr_conv.is_owned = false;
19807 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
19808 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19809 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19810 long ret_ref = (long)ret_var.inner;
19811 if (ret_var.is_owned) {
19817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19818 LDKChannelInfo this_ptr_conv;
19819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19820 this_ptr_conv.is_owned = false;
19821 LDKDirectionalChannelInfo val_conv;
19822 val_conv.inner = (void*)(val & (~1));
19823 val_conv.is_owned = (val & 1) || (val == 0);
19824 val_conv = DirectionalChannelInfo_clone(&val_conv);
19825 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
19828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19829 LDKChannelInfo this_ptr_conv;
19830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19831 this_ptr_conv.is_owned = false;
19832 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19833 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
19837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19838 LDKChannelInfo this_ptr_conv;
19839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19840 this_ptr_conv.is_owned = false;
19841 LDKPublicKey val_ref;
19842 CHECK((*env)->GetArrayLength(env, val) == 33);
19843 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19844 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
19847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19848 LDKChannelInfo this_ptr_conv;
19849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19850 this_ptr_conv.is_owned = false;
19851 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
19852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19854 long ret_ref = (long)ret_var.inner;
19855 if (ret_var.is_owned) {
19861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19862 LDKChannelInfo this_ptr_conv;
19863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19864 this_ptr_conv.is_owned = false;
19865 LDKDirectionalChannelInfo val_conv;
19866 val_conv.inner = (void*)(val & (~1));
19867 val_conv.is_owned = (val & 1) || (val == 0);
19868 val_conv = DirectionalChannelInfo_clone(&val_conv);
19869 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
19872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19873 LDKChannelInfo this_ptr_conv;
19874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19875 this_ptr_conv.is_owned = false;
19876 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
19877 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19878 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19879 long ret_ref = (long)ret_var.inner;
19880 if (ret_var.is_owned) {
19886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19887 LDKChannelInfo this_ptr_conv;
19888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19889 this_ptr_conv.is_owned = false;
19890 LDKChannelAnnouncement val_conv;
19891 val_conv.inner = (void*)(val & (~1));
19892 val_conv.is_owned = (val & 1) || (val == 0);
19893 val_conv = ChannelAnnouncement_clone(&val_conv);
19894 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
19897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19898 LDKChannelInfo orig_conv;
19899 orig_conv.inner = (void*)(orig & (~1));
19900 orig_conv.is_owned = false;
19901 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19904 long ret_ref = (long)ret_var.inner;
19905 if (ret_var.is_owned) {
19911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19912 LDKChannelInfo obj_conv;
19913 obj_conv.inner = (void*)(obj & (~1));
19914 obj_conv.is_owned = false;
19915 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19916 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19917 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19918 CVec_u8Z_free(ret_var);
19922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19923 LDKu8slice ser_ref;
19924 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19925 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19926 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19927 *ret_conv = ChannelInfo_read(ser_ref);
19928 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19929 return (long)ret_conv;
19932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19933 LDKRoutingFees this_obj_conv;
19934 this_obj_conv.inner = (void*)(this_obj & (~1));
19935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19936 RoutingFees_free(this_obj_conv);
19939 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19940 LDKRoutingFees this_ptr_conv;
19941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19942 this_ptr_conv.is_owned = false;
19943 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19948 LDKRoutingFees this_ptr_conv;
19949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19950 this_ptr_conv.is_owned = false;
19951 RoutingFees_set_base_msat(&this_ptr_conv, val);
19954 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19955 LDKRoutingFees this_ptr_conv;
19956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19957 this_ptr_conv.is_owned = false;
19958 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19963 LDKRoutingFees this_ptr_conv;
19964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19965 this_ptr_conv.is_owned = false;
19966 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19969 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) {
19970 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19971 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19972 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19973 long ret_ref = (long)ret_var.inner;
19974 if (ret_var.is_owned) {
19980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19981 LDKRoutingFees orig_conv;
19982 orig_conv.inner = (void*)(orig & (~1));
19983 orig_conv.is_owned = false;
19984 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19985 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19986 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19987 long ret_ref = (long)ret_var.inner;
19988 if (ret_var.is_owned) {
19994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19995 LDKu8slice ser_ref;
19996 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19997 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19998 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19999 *ret_conv = RoutingFees_read(ser_ref);
20000 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20001 return (long)ret_conv;
20004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
20005 LDKRoutingFees obj_conv;
20006 obj_conv.inner = (void*)(obj & (~1));
20007 obj_conv.is_owned = false;
20008 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
20009 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20010 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20011 CVec_u8Z_free(ret_var);
20015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20016 LDKNodeAnnouncementInfo this_obj_conv;
20017 this_obj_conv.inner = (void*)(this_obj & (~1));
20018 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20019 NodeAnnouncementInfo_free(this_obj_conv);
20022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20023 LDKNodeAnnouncementInfo this_ptr_conv;
20024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20025 this_ptr_conv.is_owned = false;
20026 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
20027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20029 long ret_ref = (long)ret_var.inner;
20030 if (ret_var.is_owned) {
20036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20037 LDKNodeAnnouncementInfo this_ptr_conv;
20038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20039 this_ptr_conv.is_owned = false;
20040 LDKNodeFeatures val_conv;
20041 val_conv.inner = (void*)(val & (~1));
20042 val_conv.is_owned = (val & 1) || (val == 0);
20043 val_conv = NodeFeatures_clone(&val_conv);
20044 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
20047 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
20048 LDKNodeAnnouncementInfo this_ptr_conv;
20049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20050 this_ptr_conv.is_owned = false;
20051 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
20055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20056 LDKNodeAnnouncementInfo this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
20062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
20063 LDKNodeAnnouncementInfo this_ptr_conv;
20064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20065 this_ptr_conv.is_owned = false;
20066 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
20067 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
20071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20072 LDKNodeAnnouncementInfo this_ptr_conv;
20073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20074 this_ptr_conv.is_owned = false;
20075 LDKThreeBytes val_ref;
20076 CHECK((*env)->GetArrayLength(env, val) == 3);
20077 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
20078 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
20081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
20082 LDKNodeAnnouncementInfo this_ptr_conv;
20083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20084 this_ptr_conv.is_owned = false;
20085 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20086 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
20090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20091 LDKNodeAnnouncementInfo this_ptr_conv;
20092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20093 this_ptr_conv.is_owned = false;
20094 LDKThirtyTwoBytes val_ref;
20095 CHECK((*env)->GetArrayLength(env, val) == 32);
20096 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20097 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
20100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20101 LDKNodeAnnouncementInfo this_ptr_conv;
20102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20103 this_ptr_conv.is_owned = false;
20104 LDKCVec_NetAddressZ val_constr;
20105 val_constr.datalen = (*env)->GetArrayLength(env, val);
20106 if (val_constr.datalen > 0)
20107 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20109 val_constr.data = NULL;
20110 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20111 for (size_t m = 0; m < val_constr.datalen; m++) {
20112 int64_t val_conv_12 = val_vals[m];
20113 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
20114 FREE((void*)val_conv_12);
20115 val_constr.data[m] = val_conv_12_conv;
20117 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20118 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
20121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
20122 LDKNodeAnnouncementInfo this_ptr_conv;
20123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20124 this_ptr_conv.is_owned = false;
20125 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
20126 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20127 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20128 long ret_ref = (long)ret_var.inner;
20129 if (ret_var.is_owned) {
20135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20136 LDKNodeAnnouncementInfo this_ptr_conv;
20137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20138 this_ptr_conv.is_owned = false;
20139 LDKNodeAnnouncement val_conv;
20140 val_conv.inner = (void*)(val & (~1));
20141 val_conv.is_owned = (val & 1) || (val == 0);
20142 val_conv = NodeAnnouncement_clone(&val_conv);
20143 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
20146 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) {
20147 LDKNodeFeatures features_arg_conv;
20148 features_arg_conv.inner = (void*)(features_arg & (~1));
20149 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20150 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
20151 LDKThreeBytes rgb_arg_ref;
20152 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
20153 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
20154 LDKThirtyTwoBytes alias_arg_ref;
20155 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
20156 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
20157 LDKCVec_NetAddressZ addresses_arg_constr;
20158 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
20159 if (addresses_arg_constr.datalen > 0)
20160 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20162 addresses_arg_constr.data = NULL;
20163 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
20164 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
20165 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
20166 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
20167 FREE((void*)addresses_arg_conv_12);
20168 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
20170 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
20171 LDKNodeAnnouncement announcement_message_arg_conv;
20172 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
20173 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
20174 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
20175 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
20176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20178 long ret_ref = (long)ret_var.inner;
20179 if (ret_var.is_owned) {
20185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20186 LDKNodeAnnouncementInfo orig_conv;
20187 orig_conv.inner = (void*)(orig & (~1));
20188 orig_conv.is_owned = false;
20189 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
20190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20192 long ret_ref = (long)ret_var.inner;
20193 if (ret_var.is_owned) {
20199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20200 LDKNodeAnnouncementInfo obj_conv;
20201 obj_conv.inner = (void*)(obj & (~1));
20202 obj_conv.is_owned = false;
20203 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
20204 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20205 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20206 CVec_u8Z_free(ret_var);
20210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20211 LDKu8slice ser_ref;
20212 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20213 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20214 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20215 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
20216 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20217 return (long)ret_conv;
20220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20221 LDKNodeInfo this_obj_conv;
20222 this_obj_conv.inner = (void*)(this_obj & (~1));
20223 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20224 NodeInfo_free(this_obj_conv);
20227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20228 LDKNodeInfo this_ptr_conv;
20229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20230 this_ptr_conv.is_owned = false;
20231 LDKCVec_u64Z val_constr;
20232 val_constr.datalen = (*env)->GetArrayLength(env, val);
20233 if (val_constr.datalen > 0)
20234 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20236 val_constr.data = NULL;
20237 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20238 for (size_t g = 0; g < val_constr.datalen; g++) {
20239 int64_t val_conv_6 = val_vals[g];
20240 val_constr.data[g] = val_conv_6;
20242 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20243 NodeInfo_set_channels(&this_ptr_conv, val_constr);
20246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
20247 LDKNodeInfo this_ptr_conv;
20248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20249 this_ptr_conv.is_owned = false;
20250 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
20251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20253 long ret_ref = (long)ret_var.inner;
20254 if (ret_var.is_owned) {
20260 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) {
20261 LDKNodeInfo this_ptr_conv;
20262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20263 this_ptr_conv.is_owned = false;
20264 LDKRoutingFees val_conv;
20265 val_conv.inner = (void*)(val & (~1));
20266 val_conv.is_owned = (val & 1) || (val == 0);
20267 val_conv = RoutingFees_clone(&val_conv);
20268 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
20271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
20272 LDKNodeInfo this_ptr_conv;
20273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20274 this_ptr_conv.is_owned = false;
20275 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
20276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20278 long ret_ref = (long)ret_var.inner;
20279 if (ret_var.is_owned) {
20285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20286 LDKNodeInfo this_ptr_conv;
20287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20288 this_ptr_conv.is_owned = false;
20289 LDKNodeAnnouncementInfo val_conv;
20290 val_conv.inner = (void*)(val & (~1));
20291 val_conv.is_owned = (val & 1) || (val == 0);
20292 val_conv = NodeAnnouncementInfo_clone(&val_conv);
20293 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
20296 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) {
20297 LDKCVec_u64Z channels_arg_constr;
20298 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
20299 if (channels_arg_constr.datalen > 0)
20300 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20302 channels_arg_constr.data = NULL;
20303 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
20304 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
20305 int64_t channels_arg_conv_6 = channels_arg_vals[g];
20306 channels_arg_constr.data[g] = channels_arg_conv_6;
20308 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
20309 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
20310 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
20311 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
20312 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
20313 LDKNodeAnnouncementInfo announcement_info_arg_conv;
20314 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
20315 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
20316 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
20317 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
20318 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20319 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20320 long ret_ref = (long)ret_var.inner;
20321 if (ret_var.is_owned) {
20327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20328 LDKNodeInfo orig_conv;
20329 orig_conv.inner = (void*)(orig & (~1));
20330 orig_conv.is_owned = false;
20331 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
20332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20334 long ret_ref = (long)ret_var.inner;
20335 if (ret_var.is_owned) {
20341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20342 LDKNodeInfo obj_conv;
20343 obj_conv.inner = (void*)(obj & (~1));
20344 obj_conv.is_owned = false;
20345 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
20346 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20347 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20348 CVec_u8Z_free(ret_var);
20352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20353 LDKu8slice ser_ref;
20354 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20355 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20356 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20357 *ret_conv = NodeInfo_read(ser_ref);
20358 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20359 return (long)ret_conv;
20362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
20363 LDKNetworkGraph obj_conv;
20364 obj_conv.inner = (void*)(obj & (~1));
20365 obj_conv.is_owned = false;
20366 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
20367 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20368 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20369 CVec_u8Z_free(ret_var);
20373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20374 LDKu8slice ser_ref;
20375 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20376 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20377 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20378 *ret_conv = NetworkGraph_read(ser_ref);
20379 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20380 return (long)ret_conv;
20383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
20384 LDKThirtyTwoBytes genesis_hash_ref;
20385 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
20386 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
20387 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
20388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20390 long ret_ref = (long)ret_var.inner;
20391 if (ret_var.is_owned) {
20397 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) {
20398 LDKNetworkGraph this_arg_conv;
20399 this_arg_conv.inner = (void*)(this_arg & (~1));
20400 this_arg_conv.is_owned = false;
20401 LDKNodeAnnouncement msg_conv;
20402 msg_conv.inner = (void*)(msg & (~1));
20403 msg_conv.is_owned = false;
20404 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20405 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
20406 return (long)ret_conv;
20409 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) {
20410 LDKNetworkGraph this_arg_conv;
20411 this_arg_conv.inner = (void*)(this_arg & (~1));
20412 this_arg_conv.is_owned = false;
20413 LDKUnsignedNodeAnnouncement msg_conv;
20414 msg_conv.inner = (void*)(msg & (~1));
20415 msg_conv.is_owned = false;
20416 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20417 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
20418 return (long)ret_conv;
20421 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) {
20422 LDKNetworkGraph this_arg_conv;
20423 this_arg_conv.inner = (void*)(this_arg & (~1));
20424 this_arg_conv.is_owned = false;
20425 LDKChannelAnnouncement msg_conv;
20426 msg_conv.inner = (void*)(msg & (~1));
20427 msg_conv.is_owned = false;
20428 LDKAccess *chain_access_conv_ptr = NULL;
20429 if (chain_access != 0) {
20430 LDKAccess chain_access_conv;
20431 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20432 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20433 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20434 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20436 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20437 *chain_access_conv_ptr = chain_access_conv;
20439 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20440 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20441 return (long)ret_conv;
20444 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) {
20445 LDKNetworkGraph this_arg_conv;
20446 this_arg_conv.inner = (void*)(this_arg & (~1));
20447 this_arg_conv.is_owned = false;
20448 LDKUnsignedChannelAnnouncement msg_conv;
20449 msg_conv.inner = (void*)(msg & (~1));
20450 msg_conv.is_owned = false;
20451 LDKAccess *chain_access_conv_ptr = NULL;
20452 if (chain_access != 0) {
20453 LDKAccess chain_access_conv;
20454 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20455 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20456 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20457 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20459 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20460 *chain_access_conv_ptr = chain_access_conv;
20462 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20463 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20464 return (long)ret_conv;
20467 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) {
20468 LDKNetworkGraph this_arg_conv;
20469 this_arg_conv.inner = (void*)(this_arg & (~1));
20470 this_arg_conv.is_owned = false;
20471 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20475 LDKNetworkGraph this_arg_conv;
20476 this_arg_conv.inner = (void*)(this_arg & (~1));
20477 this_arg_conv.is_owned = false;
20478 LDKChannelUpdate msg_conv;
20479 msg_conv.inner = (void*)(msg & (~1));
20480 msg_conv.is_owned = false;
20481 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20482 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20483 return (long)ret_conv;
20486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20487 LDKNetworkGraph this_arg_conv;
20488 this_arg_conv.inner = (void*)(this_arg & (~1));
20489 this_arg_conv.is_owned = false;
20490 LDKUnsignedChannelUpdate msg_conv;
20491 msg_conv.inner = (void*)(msg & (~1));
20492 msg_conv.is_owned = false;
20493 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20494 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
20495 return (long)ret_conv;