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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
781 LDKMessageSendEvent_SendAcceptChannel_class =
782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
783 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
784 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
785 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
786 LDKMessageSendEvent_SendOpenChannel_class =
787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
788 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
789 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
790 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
791 LDKMessageSendEvent_SendFundingCreated_class =
792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
793 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
794 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
795 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
796 LDKMessageSendEvent_SendFundingSigned_class =
797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
798 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
799 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
800 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
801 LDKMessageSendEvent_SendFundingLocked_class =
802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
803 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
804 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
805 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
806 LDKMessageSendEvent_SendAnnouncementSignatures_class =
807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
808 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
809 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
810 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
811 LDKMessageSendEvent_UpdateHTLCs_class =
812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
813 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
814 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
815 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
816 LDKMessageSendEvent_SendRevokeAndACK_class =
817 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
818 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
819 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
820 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
821 LDKMessageSendEvent_SendClosingSigned_class =
822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
823 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
824 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
825 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
826 LDKMessageSendEvent_SendShutdown_class =
827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
828 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
829 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
830 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
831 LDKMessageSendEvent_SendChannelReestablish_class =
832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
833 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
834 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
835 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
836 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
838 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
839 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
840 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
841 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
843 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
844 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
845 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
846 LDKMessageSendEvent_BroadcastChannelUpdate_class =
847 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
848 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
849 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
850 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
851 LDKMessageSendEvent_HandleError_class =
852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
853 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
854 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
855 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
856 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
858 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
859 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
860 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
861 LDKMessageSendEvent_SendChannelRangeQuery_class =
862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
863 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
864 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
865 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
866 LDKMessageSendEvent_SendShortIdsQuery_class =
867 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
868 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
869 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
870 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
872 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
873 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
875 case LDKMessageSendEvent_SendAcceptChannel: {
876 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
877 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
878 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
879 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
880 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
881 long msg_ref = (long)msg_var.inner & ~1;
882 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
884 case LDKMessageSendEvent_SendOpenChannel: {
885 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
886 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
887 LDKOpenChannel msg_var = obj->send_open_channel.msg;
888 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
889 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
890 long msg_ref = (long)msg_var.inner & ~1;
891 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
893 case LDKMessageSendEvent_SendFundingCreated: {
894 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
895 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
896 LDKFundingCreated msg_var = obj->send_funding_created.msg;
897 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
898 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
899 long msg_ref = (long)msg_var.inner & ~1;
900 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
902 case LDKMessageSendEvent_SendFundingSigned: {
903 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
904 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
905 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
906 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
907 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
908 long msg_ref = (long)msg_var.inner & ~1;
909 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
911 case LDKMessageSendEvent_SendFundingLocked: {
912 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
913 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
914 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
915 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
916 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
917 long msg_ref = (long)msg_var.inner & ~1;
918 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
920 case LDKMessageSendEvent_SendAnnouncementSignatures: {
921 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
922 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
923 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
924 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
925 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
926 long msg_ref = (long)msg_var.inner & ~1;
927 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
929 case LDKMessageSendEvent_UpdateHTLCs: {
930 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
931 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
932 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
933 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
934 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
935 long updates_ref = (long)updates_var.inner & ~1;
936 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
938 case LDKMessageSendEvent_SendRevokeAndACK: {
939 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
940 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
941 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
942 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
943 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
944 long msg_ref = (long)msg_var.inner & ~1;
945 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
947 case LDKMessageSendEvent_SendClosingSigned: {
948 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
949 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
950 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
951 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
952 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
953 long msg_ref = (long)msg_var.inner & ~1;
954 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
956 case LDKMessageSendEvent_SendShutdown: {
957 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
958 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
959 LDKShutdown msg_var = obj->send_shutdown.msg;
960 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
961 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
962 long msg_ref = (long)msg_var.inner & ~1;
963 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
965 case LDKMessageSendEvent_SendChannelReestablish: {
966 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
967 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
968 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
969 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
970 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
971 long msg_ref = (long)msg_var.inner & ~1;
972 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
974 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
975 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
976 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
977 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
978 long msg_ref = (long)msg_var.inner & ~1;
979 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
980 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 long update_msg_ref = (long)update_msg_var.inner & ~1;
983 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
985 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
986 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
987 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
988 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
989 long msg_ref = (long)msg_var.inner & ~1;
990 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
992 case LDKMessageSendEvent_BroadcastChannelUpdate: {
993 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
994 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 long msg_ref = (long)msg_var.inner & ~1;
997 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
999 case LDKMessageSendEvent_HandleError: {
1000 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1001 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1002 long action_ref = ((long)&obj->handle_error.action) | 1;
1003 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1005 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1006 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1007 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1009 case LDKMessageSendEvent_SendChannelRangeQuery: {
1010 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1011 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1012 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1013 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1014 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1015 long msg_ref = (long)msg_var.inner & ~1;
1016 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1018 case LDKMessageSendEvent_SendShortIdsQuery: {
1019 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1020 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1021 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1022 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1023 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1024 long msg_ref = (long)msg_var.inner & ~1;
1025 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1031 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1032 ret->datalen = (*env)->GetArrayLength(env, elems);
1033 if (ret->datalen == 0) {
1036 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1037 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1038 for (size_t i = 0; i < ret->datalen; i++) {
1039 int64_t arr_elem = java_elems[i];
1040 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1041 FREE((void*)arr_elem);
1042 ret->data[i] = arr_elem_conv;
1044 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1048 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1049 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1050 for (size_t i = 0; i < ret.datalen; i++) {
1051 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1056 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1059 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1060 CHECK(val->result_ok);
1061 return *val->contents.result;
1063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1064 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1065 CHECK(!val->result_ok);
1066 LDKLightningError err_var = (*val->contents.err);
1067 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1068 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1069 long err_ref = (long)err_var.inner & ~1;
1072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
1073 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1074 LDKChannelAnnouncement a_conv;
1075 a_conv.inner = (void*)(a & (~1));
1076 a_conv.is_owned = (a & 1) || (a == 0);
1077 a_conv = ChannelAnnouncement_clone(&a_conv);
1079 LDKChannelUpdate b_conv;
1080 b_conv.inner = (void*)(b & (~1));
1081 b_conv.is_owned = (b & 1) || (b == 0);
1082 b_conv = ChannelUpdate_clone(&b_conv);
1084 LDKChannelUpdate c_conv;
1085 c_conv.inner = (void*)(c & (~1));
1086 c_conv.is_owned = (c & 1) || (c == 0);
1087 c_conv = ChannelUpdate_clone(&c_conv);
1091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1092 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1093 LDKChannelAnnouncement a_var = tuple->a;
1094 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1095 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1096 long a_ref = (long)a_var.inner & ~1;
1099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1100 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1101 LDKChannelUpdate b_var = tuple->b;
1102 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1103 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1104 long b_ref = (long)b_var.inner & ~1;
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
1108 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1109 LDKChannelUpdate c_var = tuple->c;
1110 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 long c_ref = (long)c_var.inner & ~1;
1115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1116 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1117 ret->datalen = (*env)->GetArrayLength(env, elems);
1118 if (ret->datalen == 0) {
1121 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1122 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1123 for (size_t i = 0; i < ret->datalen; i++) {
1124 int64_t arr_elem = java_elems[i];
1125 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1126 FREE((void*)arr_elem);
1127 ret->data[i] = arr_elem_conv;
1129 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1133 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
1134 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
1135 for (size_t i = 0; i < ret.datalen; i++) {
1136 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1141 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
1142 ret->datalen = (*env)->GetArrayLength(env, elems);
1143 if (ret->datalen == 0) {
1146 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
1147 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1148 for (size_t i = 0; i < ret->datalen; i++) {
1149 int64_t arr_elem = java_elems[i];
1150 LDKNodeAnnouncement arr_elem_conv;
1151 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1152 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1153 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
1154 ret->data[i] = arr_elem_conv;
1156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1160 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
1161 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
1162 for (size_t i = 0; i < ret.datalen; i++) {
1163 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
1167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1168 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
1170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1171 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1172 CHECK(val->result_ok);
1173 return *val->contents.result;
1175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1176 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1177 CHECK(!val->result_ok);
1178 LDKLightningError err_var = (*val->contents.err);
1179 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 long err_ref = (long)err_var.inner & ~1;
1184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1185 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
1187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1188 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1189 CHECK(val->result_ok);
1190 LDKCVec_u8Z res_var = (*val->contents.result);
1191 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
1192 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
1195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1196 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1197 CHECK(!val->result_ok);
1198 LDKPeerHandleError err_var = (*val->contents.err);
1199 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1200 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1201 long err_ref = (long)err_var.inner & ~1;
1204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1205 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
1207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1208 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1209 CHECK(val->result_ok);
1210 return *val->contents.result;
1212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1213 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1214 CHECK(!val->result_ok);
1215 LDKPeerHandleError err_var = (*val->contents.err);
1216 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 long err_ref = (long)err_var.inner & ~1;
1221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1222 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
1224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1225 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1226 CHECK(val->result_ok);
1227 return *val->contents.result;
1229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1230 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1231 CHECK(!val->result_ok);
1232 LDKPeerHandleError err_var = (*val->contents.err);
1233 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 long err_ref = (long)err_var.inner & ~1;
1238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1239 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1242 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1243 CHECK(val->result_ok);
1244 LDKInitFeatures res_var = (*val->contents.result);
1245 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1246 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1247 long res_ref = (long)res_var.inner & ~1;
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1251 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1252 CHECK(!val->result_ok);
1253 LDKDecodeError err_var = (*val->contents.err);
1254 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1255 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1256 long err_ref = (long)err_var.inner & ~1;
1259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1260 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1263 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1264 CHECK(val->result_ok);
1265 LDKNodeFeatures res_var = (*val->contents.result);
1266 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1268 long res_ref = (long)res_var.inner & ~1;
1271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1272 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1273 CHECK(!val->result_ok);
1274 LDKDecodeError err_var = (*val->contents.err);
1275 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1276 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1277 long err_ref = (long)err_var.inner & ~1;
1280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1281 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1284 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1285 CHECK(val->result_ok);
1286 LDKChannelFeatures res_var = (*val->contents.result);
1287 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1288 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1289 long res_ref = (long)res_var.inner & ~1;
1292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1293 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1294 CHECK(!val->result_ok);
1295 LDKDecodeError err_var = (*val->contents.err);
1296 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1297 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1298 long err_ref = (long)err_var.inner & ~1;
1301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1302 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1305 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1306 CHECK(val->result_ok);
1307 LDKInvoiceFeatures res_var = (*val->contents.result);
1308 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1309 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1310 long res_ref = (long)res_var.inner & ~1;
1313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1314 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1315 CHECK(!val->result_ok);
1316 LDKDecodeError err_var = (*val->contents.err);
1317 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1318 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1319 long err_ref = (long)err_var.inner & ~1;
1322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1323 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
1325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1326 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1327 CHECK(val->result_ok);
1328 LDKChannelConfig res_var = (*val->contents.result);
1329 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 long res_ref = (long)res_var.inner & ~1;
1334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1335 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1336 CHECK(!val->result_ok);
1337 LDKDecodeError err_var = (*val->contents.err);
1338 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1339 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1340 long err_ref = (long)err_var.inner & ~1;
1343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1344 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1347 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1348 CHECK(val->result_ok);
1349 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1350 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1352 long res_ref = (long)res_var.inner & ~1;
1355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1356 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1357 CHECK(!val->result_ok);
1358 LDKDecodeError err_var = (*val->contents.err);
1359 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1360 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1361 long err_ref = (long)err_var.inner & ~1;
1364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1365 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1368 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1369 CHECK(val->result_ok);
1370 LDKChannelInfo res_var = (*val->contents.result);
1371 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1372 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1373 long res_ref = (long)res_var.inner & ~1;
1376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1377 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1378 CHECK(!val->result_ok);
1379 LDKDecodeError err_var = (*val->contents.err);
1380 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1381 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1382 long err_ref = (long)err_var.inner & ~1;
1385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1386 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1389 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1390 CHECK(val->result_ok);
1391 LDKRoutingFees res_var = (*val->contents.result);
1392 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1393 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1394 long res_ref = (long)res_var.inner & ~1;
1397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1398 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1399 CHECK(!val->result_ok);
1400 LDKDecodeError err_var = (*val->contents.err);
1401 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1402 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1403 long err_ref = (long)err_var.inner & ~1;
1406 static jclass LDKNetAddress_IPv4_class = NULL;
1407 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1408 static jclass LDKNetAddress_IPv6_class = NULL;
1409 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1410 static jclass LDKNetAddress_OnionV2_class = NULL;
1411 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1412 static jclass LDKNetAddress_OnionV3_class = NULL;
1413 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
1414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
1415 LDKNetAddress_IPv4_class =
1416 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
1417 CHECK(LDKNetAddress_IPv4_class != NULL);
1418 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
1419 CHECK(LDKNetAddress_IPv4_meth != NULL);
1420 LDKNetAddress_IPv6_class =
1421 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
1422 CHECK(LDKNetAddress_IPv6_class != NULL);
1423 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
1424 CHECK(LDKNetAddress_IPv6_meth != NULL);
1425 LDKNetAddress_OnionV2_class =
1426 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
1427 CHECK(LDKNetAddress_OnionV2_class != NULL);
1428 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
1429 CHECK(LDKNetAddress_OnionV2_meth != NULL);
1430 LDKNetAddress_OnionV3_class =
1431 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
1432 CHECK(LDKNetAddress_OnionV3_class != NULL);
1433 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
1434 CHECK(LDKNetAddress_OnionV3_meth != NULL);
1436 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1437 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1439 case LDKNetAddress_IPv4: {
1440 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
1441 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
1442 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
1444 case LDKNetAddress_IPv6: {
1445 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
1446 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
1447 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
1449 case LDKNetAddress_OnionV2: {
1450 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
1451 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
1452 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
1454 case LDKNetAddress_OnionV3: {
1455 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
1456 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
1457 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);
1462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1463 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1464 ret->datalen = (*env)->GetArrayLength(env, elems);
1465 if (ret->datalen == 0) {
1468 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1469 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1470 for (size_t i = 0; i < ret->datalen; i++) {
1471 int64_t arr_elem = java_elems[i];
1472 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1473 FREE((void*)arr_elem);
1474 ret->data[i] = arr_elem_conv;
1476 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1480 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1481 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1482 for (size_t i = 0; i < ret.datalen; i++) {
1483 ret.data[i] = NetAddress_clone(&orig->data[i]);
1487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1488 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1491 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1492 CHECK(val->result_ok);
1493 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1494 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1495 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1496 long res_ref = (long)res_var.inner & ~1;
1499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1500 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1501 CHECK(!val->result_ok);
1502 LDKDecodeError err_var = (*val->contents.err);
1503 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1504 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1505 long err_ref = (long)err_var.inner & ~1;
1508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1509 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1510 ret->datalen = (*env)->GetArrayLength(env, elems);
1511 if (ret->datalen == 0) {
1514 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1515 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1516 for (size_t i = 0; i < ret->datalen; i++) {
1517 ret->data[i] = java_elems[i];
1519 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1523 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1524 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1525 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1529 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1532 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1533 CHECK(val->result_ok);
1534 LDKNodeInfo res_var = (*val->contents.result);
1535 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1536 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1537 long res_ref = (long)res_var.inner & ~1;
1540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1541 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1542 CHECK(!val->result_ok);
1543 LDKDecodeError err_var = (*val->contents.err);
1544 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1545 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1546 long err_ref = (long)err_var.inner & ~1;
1549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1550 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1553 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1554 CHECK(val->result_ok);
1555 LDKNetworkGraph res_var = (*val->contents.result);
1556 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1557 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1558 long res_ref = (long)res_var.inner & ~1;
1561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1562 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1563 CHECK(!val->result_ok);
1564 LDKDecodeError err_var = (*val->contents.err);
1565 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1566 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1567 long err_ref = (long)err_var.inner & ~1;
1570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1571 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1573 LDKTransaction b_ref;
1574 b_ref.datalen = (*env)->GetArrayLength(env, b);
1575 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1576 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1577 b_ref.data_is_owned = false;
1581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1582 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1586 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1587 LDKTransaction b_var = tuple->b;
1588 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1589 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1593 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1594 ret->datalen = (*env)->GetArrayLength(env, elems);
1595 if (ret->datalen == 0) {
1598 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1599 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1600 for (size_t i = 0; i < ret->datalen; i++) {
1601 int64_t arr_elem = java_elems[i];
1602 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1603 FREE((void*)arr_elem);
1604 ret->data[i] = arr_elem_conv;
1606 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1611 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1614 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1615 CHECK(val->result_ok);
1616 return *val->contents.result;
1618 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1619 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1620 CHECK(!val->result_ok);
1621 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1624 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1625 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1626 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1627 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1629 LDKMonitorEvent_HTLCEvent_class =
1630 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1631 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1632 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "()V");
1633 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1634 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1635 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1636 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1637 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "()V");
1638 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1641 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1643 case LDKMonitorEvent_HTLCEvent: {
1644 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth);
1646 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1647 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth);
1652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1653 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1654 ret->datalen = (*env)->GetArrayLength(env, elems);
1655 if (ret->datalen == 0) {
1658 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1659 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1660 for (size_t i = 0; i < ret->datalen; i++) {
1661 int64_t arr_elem = java_elems[i];
1662 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1663 FREE((void*)arr_elem);
1664 ret->data[i] = arr_elem_conv;
1666 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1670 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1671 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1672 for (size_t i = 0; i < ret.datalen; i++) {
1673 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1677 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1678 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1679 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1680 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1681 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1682 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1684 LDKSpendableOutputDescriptor_StaticOutput_class =
1685 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1686 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1687 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1688 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1689 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1690 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1691 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1692 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "()V");
1693 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1694 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1695 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1696 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1697 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "()V");
1698 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1700 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1701 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1703 case LDKSpendableOutputDescriptor_StaticOutput: {
1704 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1705 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1706 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1707 long outpoint_ref = (long)outpoint_var.inner & ~1;
1708 long output_ref = ((long)&obj->static_output.output) | 1;
1709 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
1711 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1712 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth);
1714 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1715 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth);
1720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1721 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1722 ret->datalen = (*env)->GetArrayLength(env, elems);
1723 if (ret->datalen == 0) {
1726 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1727 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1728 for (size_t i = 0; i < ret->datalen; i++) {
1729 int64_t arr_elem = java_elems[i];
1730 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1731 FREE((void*)arr_elem);
1732 ret->data[i] = arr_elem_conv;
1734 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1738 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1739 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1740 for (size_t i = 0; i < ret.datalen; i++) {
1741 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1745 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1746 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1747 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1748 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1749 static jclass LDKEvent_PaymentReceived_class = NULL;
1750 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1751 static jclass LDKEvent_PaymentSent_class = NULL;
1752 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1753 static jclass LDKEvent_PaymentFailed_class = NULL;
1754 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1755 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1756 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1757 static jclass LDKEvent_SpendableOutputs_class = NULL;
1758 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1760 LDKEvent_FundingGenerationReady_class =
1761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1762 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1763 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1764 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1765 LDKEvent_FundingBroadcastSafe_class =
1766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1767 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1768 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1769 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1770 LDKEvent_PaymentReceived_class =
1771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1772 CHECK(LDKEvent_PaymentReceived_class != NULL);
1773 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1774 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1775 LDKEvent_PaymentSent_class =
1776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1777 CHECK(LDKEvent_PaymentSent_class != NULL);
1778 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1779 CHECK(LDKEvent_PaymentSent_meth != NULL);
1780 LDKEvent_PaymentFailed_class =
1781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1782 CHECK(LDKEvent_PaymentFailed_class != NULL);
1783 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1784 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1785 LDKEvent_PendingHTLCsForwardable_class =
1786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1787 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1788 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1789 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1790 LDKEvent_SpendableOutputs_class =
1791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1792 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1793 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1794 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1797 LDKEvent *obj = (LDKEvent*)ptr;
1799 case LDKEvent_FundingGenerationReady: {
1800 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1801 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1802 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1803 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1804 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1805 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);
1807 case LDKEvent_FundingBroadcastSafe: {
1808 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1809 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1810 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1811 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1812 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1814 case LDKEvent_PaymentReceived: {
1815 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1816 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1817 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1818 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1819 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1821 case LDKEvent_PaymentSent: {
1822 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1823 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1824 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1826 case LDKEvent_PaymentFailed: {
1827 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1828 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1829 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1831 case LDKEvent_PendingHTLCsForwardable: {
1832 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1834 case LDKEvent_SpendableOutputs: {
1835 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1836 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1837 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1838 for (size_t b = 0; b < outputs_var.datalen; b++) {
1839 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1840 outputs_arr_ptr[b] = outputs_conv_27_ref;
1842 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1843 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1849 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1850 ret->datalen = (*env)->GetArrayLength(env, elems);
1851 if (ret->datalen == 0) {
1854 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1855 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1856 for (size_t i = 0; i < ret->datalen; i++) {
1857 int64_t arr_elem = java_elems[i];
1858 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1859 FREE((void*)arr_elem);
1860 ret->data[i] = arr_elem_conv;
1862 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1866 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1867 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1868 for (size_t i = 0; i < ret.datalen; i++) {
1869 ret.data[i] = Event_clone(&orig->data[i]);
1873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1874 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1877 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1878 CHECK(val->result_ok);
1879 LDKOutPoint res_var = (*val->contents.result);
1880 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1881 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1882 long res_ref = (long)res_var.inner & ~1;
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1886 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1887 CHECK(!val->result_ok);
1888 LDKDecodeError err_var = (*val->contents.err);
1889 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 long err_ref = (long)err_var.inner & ~1;
1894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1895 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1898 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1899 CHECK(val->result_ok);
1900 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1901 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1902 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1903 long res_ref = (long)res_var.inner & ~1;
1906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1907 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1908 CHECK(!val->result_ok);
1909 LDKDecodeError err_var = (*val->contents.err);
1910 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 long err_ref = (long)err_var.inner & ~1;
1915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1916 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1919 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1920 CHECK(val->result_ok);
1921 LDKHTLCUpdate res_var = (*val->contents.result);
1922 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1923 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1924 long res_ref = (long)res_var.inner & ~1;
1927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1928 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1929 CHECK(!val->result_ok);
1930 LDKDecodeError err_var = (*val->contents.err);
1931 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1932 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1933 long err_ref = (long)err_var.inner & ~1;
1936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1937 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1940 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1941 CHECK(val->result_ok);
1942 return *val->contents.result;
1944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1945 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1946 CHECK(!val->result_ok);
1947 LDKMonitorUpdateError err_var = (*val->contents.err);
1948 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1949 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1950 long err_ref = (long)err_var.inner & ~1;
1953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1954 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1956 a_conv.inner = (void*)(a & (~1));
1957 a_conv.is_owned = (a & 1) || (a == 0);
1958 a_conv = OutPoint_clone(&a_conv);
1961 b_ref.datalen = (*env)->GetArrayLength(env, b);
1962 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1963 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1968 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1969 LDKOutPoint a_var = tuple->a;
1970 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1971 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1972 long a_ref = (long)a_var.inner & ~1;
1975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1976 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1977 LDKCVec_u8Z b_var = tuple->b;
1978 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1979 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
1983 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
1986 b_ref.datalen = (*env)->GetArrayLength(env, b);
1987 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1988 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1992 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1993 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1997 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1998 LDKCVec_u8Z b_var = tuple->b;
1999 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
2000 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
2003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2004 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
2005 ret->datalen = (*env)->GetArrayLength(env, elems);
2006 if (ret->datalen == 0) {
2009 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
2010 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2011 for (size_t i = 0; i < ret->datalen; i++) {
2012 int64_t arr_elem = java_elems[i];
2013 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
2014 FREE((void*)arr_elem);
2015 ret->data[i] = arr_elem_conv;
2017 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2021 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
2022 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
2023 for (size_t i = 0; i < ret.datalen; i++) {
2024 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
2028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2029 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
2030 LDKThirtyTwoBytes a_ref;
2031 CHECK((*env)->GetArrayLength(env, a) == 32);
2032 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2034 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
2035 b_constr.datalen = (*env)->GetArrayLength(env, b);
2036 if (b_constr.datalen > 0)
2037 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
2039 b_constr.data = NULL;
2040 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2041 for (size_t b = 0; b < b_constr.datalen; b++) {
2042 int64_t b_conv_27 = b_vals[b];
2043 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
2044 FREE((void*)b_conv_27);
2045 b_constr.data[b] = b_conv_27_conv;
2047 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2052 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2053 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2054 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2057 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2058 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2059 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
2060 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2061 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2062 for (size_t b = 0; b < b_var.datalen; b++) {
2063 long b_conv_27_ref = (long)(&b_var.data[b]) | 1;
2064 b_arr_ptr[b] = b_conv_27_ref;
2066 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2070 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
2071 ret->datalen = (*env)->GetArrayLength(env, elems);
2072 if (ret->datalen == 0) {
2075 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
2076 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2077 for (size_t i = 0; i < ret->datalen; i++) {
2078 int64_t arr_elem = java_elems[i];
2079 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
2080 FREE((void*)arr_elem);
2081 ret->data[i] = arr_elem_conv;
2083 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
2088 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
2090 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
2095 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2096 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2100 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2101 long b_ref = ((long)&tuple->b) | 1;
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2105 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
2106 ret->datalen = (*env)->GetArrayLength(env, elems);
2107 if (ret->datalen == 0) {
2110 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
2111 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2112 for (size_t i = 0; i < ret->datalen; i++) {
2113 int64_t arr_elem = java_elems[i];
2114 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
2115 FREE((void*)arr_elem);
2116 ret->data[i] = arr_elem_conv;
2118 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2122 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
2123 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
2124 for (size_t i = 0; i < ret.datalen; i++) {
2125 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
2129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2130 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
2131 LDKThirtyTwoBytes a_ref;
2132 CHECK((*env)->GetArrayLength(env, a) == 32);
2133 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2135 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
2136 b_constr.datalen = (*env)->GetArrayLength(env, b);
2137 if (b_constr.datalen > 0)
2138 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
2140 b_constr.data = NULL;
2141 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2142 for (size_t a = 0; a < b_constr.datalen; a++) {
2143 int64_t b_conv_26 = b_vals[a];
2144 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
2145 FREE((void*)b_conv_26);
2146 b_constr.data[a] = b_conv_26_conv;
2148 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2153 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2154 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2155 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2158 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2159 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2160 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
2161 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2162 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2163 for (size_t a = 0; a < b_var.datalen; a++) {
2164 long b_conv_26_ref = (long)(&b_var.data[a]) | 1;
2165 b_arr_ptr[a] = b_conv_26_ref;
2167 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2171 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
2172 ret->datalen = (*env)->GetArrayLength(env, elems);
2173 if (ret->datalen == 0) {
2176 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
2177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2178 for (size_t i = 0; i < ret->datalen; i++) {
2179 int64_t arr_elem = java_elems[i];
2180 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
2181 FREE((void*)arr_elem);
2182 ret->data[i] = arr_elem_conv;
2184 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2189 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2191 CHECK((*env)->GetArrayLength(env, a) == 64);
2192 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2194 LDKCVec_SignatureZ b_constr;
2195 b_constr.datalen = (*env)->GetArrayLength(env, b);
2196 if (b_constr.datalen > 0)
2197 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2199 b_constr.data = NULL;
2200 for (size_t i = 0; i < b_constr.datalen; i++) {
2201 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2202 LDKSignature b_conv_8_ref;
2203 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2204 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2205 b_constr.data[i] = b_conv_8_ref;
2210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2211 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2212 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2213 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2216 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2217 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2218 LDKCVec_SignatureZ b_var = tuple->b;
2219 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2221 for (size_t i = 0; i < b_var.datalen; i++) {
2222 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2223 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2224 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2229 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2232 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2233 CHECK(val->result_ok);
2234 long res_ref = (long)(&(*val->contents.result)) | 1;
2237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2238 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2239 CHECK(!val->result_ok);
2240 return *val->contents.err;
2242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2243 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2246 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2247 CHECK(val->result_ok);
2248 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2249 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2253 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2254 CHECK(!val->result_ok);
2255 return *val->contents.err;
2257 typedef struct LDKSign_JCalls {
2258 atomic_size_t refcnt;
2261 jmethodID get_per_commitment_point_meth;
2262 jmethodID release_commitment_secret_meth;
2263 jmethodID channel_keys_id_meth;
2264 jmethodID sign_counterparty_commitment_meth;
2265 jmethodID sign_holder_commitment_and_htlcs_meth;
2266 jmethodID sign_justice_transaction_meth;
2267 jmethodID sign_counterparty_htlc_transaction_meth;
2268 jmethodID sign_closing_transaction_meth;
2269 jmethodID sign_channel_announcement_meth;
2270 jmethodID ready_channel_meth;
2271 jmethodID write_meth;
2273 static void LDKSign_JCalls_free(void* this_arg) {
2274 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2275 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2277 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2278 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2282 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
2283 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2285 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2286 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2288 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2289 LDKPublicKey ret_ref;
2290 CHECK((*env)->GetArrayLength(env, ret) == 33);
2291 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2294 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
2295 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2297 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2298 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2300 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2301 LDKThirtyTwoBytes ret_ref;
2302 CHECK((*env)->GetArrayLength(env, ret) == 32);
2303 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2306 LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) {
2307 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2309 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2310 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2312 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2313 LDKThirtyTwoBytes ret_ref;
2314 CHECK((*env)->GetArrayLength(env, ret) == 32);
2315 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2318 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2319 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2321 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2322 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2323 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2324 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 long commitment_tx_ref = (long)commitment_tx_var.inner;
2327 if (commitment_tx_var.is_owned) {
2328 commitment_tx_ref |= 1;
2330 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2332 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2333 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2334 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2337 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2338 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2340 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2341 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2342 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2343 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2344 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2345 long commitment_tx_ref = (long)commitment_tx_var.inner;
2346 if (commitment_tx_var.is_owned) {
2347 commitment_tx_ref |= 1;
2349 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2351 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2352 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2353 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2356 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2357 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2359 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2360 LDKTransaction justice_tx_var = justice_tx;
2361 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2362 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2363 Transaction_free(justice_tx_var);
2364 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2365 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2366 LDKHTLCOutputInCommitment htlc_var = *htlc;
2367 htlc_var = HTLCOutputInCommitment_clone(htlc);
2368 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 long htlc_ref = (long)htlc_var.inner;
2371 if (htlc_var.is_owned) {
2374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2376 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);
2377 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2378 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2381 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2382 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2384 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2385 LDKTransaction htlc_tx_var = htlc_tx;
2386 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2387 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2388 Transaction_free(htlc_tx_var);
2389 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2390 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2391 LDKHTLCOutputInCommitment htlc_var = *htlc;
2392 htlc_var = HTLCOutputInCommitment_clone(htlc);
2393 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2394 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2395 long htlc_ref = (long)htlc_var.inner;
2396 if (htlc_var.is_owned) {
2399 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2401 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);
2402 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2403 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2406 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2407 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2409 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2410 LDKTransaction closing_tx_var = closing_tx;
2411 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2412 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2413 Transaction_free(closing_tx_var);
2414 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2416 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2417 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2418 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2421 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2422 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2424 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2425 LDKUnsignedChannelAnnouncement msg_var = *msg;
2426 msg_var = UnsignedChannelAnnouncement_clone(msg);
2427 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2428 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2429 long msg_ref = (long)msg_var.inner;
2430 if (msg_var.is_owned) {
2433 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2435 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2436 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2437 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2440 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2441 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2443 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2444 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2445 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2446 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2447 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2448 long channel_parameters_ref = (long)channel_parameters_var.inner;
2449 if (channel_parameters_var.is_owned) {
2450 channel_parameters_ref |= 1;
2452 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2454 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2456 LDKCVec_u8Z write_jcall(const void* this_arg) {
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 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2462 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2463 LDKCVec_u8Z ret_ref;
2464 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2465 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2466 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2469 static void* LDKSign_JCalls_clone(const void* this_arg) {
2470 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2472 return (void*) this_arg;
2474 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2475 jclass c = (*env)->GetObjectClass(env, o);
2477 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2478 atomic_init(&calls->refcnt, 1);
2479 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2480 calls->o = (*env)->NewWeakGlobalRef(env, o);
2481 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2482 CHECK(calls->get_per_commitment_point_meth != NULL);
2483 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2484 CHECK(calls->release_commitment_secret_meth != NULL);
2485 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2486 CHECK(calls->channel_keys_id_meth != NULL);
2487 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2488 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2489 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2490 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2491 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2492 CHECK(calls->sign_justice_transaction_meth != NULL);
2493 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2494 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2495 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2496 CHECK(calls->sign_closing_transaction_meth != NULL);
2497 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2498 CHECK(calls->sign_channel_announcement_meth != NULL);
2499 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2500 CHECK(calls->ready_channel_meth != NULL);
2501 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2502 CHECK(calls->write_meth != NULL);
2504 LDKChannelPublicKeys pubkeys_conv;
2505 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2506 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2507 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2510 .this_arg = (void*) calls,
2511 .get_per_commitment_point = get_per_commitment_point_jcall,
2512 .release_commitment_secret = release_commitment_secret_jcall,
2513 .channel_keys_id = channel_keys_id_jcall,
2514 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2515 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
2516 .sign_justice_transaction = sign_justice_transaction_jcall,
2517 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2518 .sign_closing_transaction = sign_closing_transaction_jcall,
2519 .sign_channel_announcement = sign_channel_announcement_jcall,
2520 .ready_channel = ready_channel_jcall,
2521 .clone = LDKSign_JCalls_clone,
2522 .write = write_jcall,
2523 .free = LDKSign_JCalls_free,
2524 .pubkeys = pubkeys_conv,
2525 .set_pubkeys = NULL,
2529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2530 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2531 *res_ptr = LDKSign_init(env, clz, o, pubkeys);
2532 return (long)res_ptr;
2534 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) {
2535 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2536 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2542 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2543 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2549 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2555 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) {
2556 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2557 LDKCommitmentTransaction commitment_tx_conv;
2558 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2559 commitment_tx_conv.is_owned = false;
2560 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2561 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2562 return (long)ret_conv;
2565 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) {
2566 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2567 LDKHolderCommitmentTransaction commitment_tx_conv;
2568 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2569 commitment_tx_conv.is_owned = false;
2570 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2571 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2572 return (long)ret_conv;
2575 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) {
2576 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2577 LDKTransaction justice_tx_ref;
2578 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2579 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2580 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2581 justice_tx_ref.data_is_owned = true;
2582 unsigned char per_commitment_key_arr[32];
2583 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2584 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2585 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2586 LDKHTLCOutputInCommitment htlc_conv;
2587 htlc_conv.inner = (void*)(htlc & (~1));
2588 htlc_conv.is_owned = false;
2589 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2590 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2591 return (long)ret_conv;
2594 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) {
2595 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2596 LDKTransaction htlc_tx_ref;
2597 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2598 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2599 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2600 htlc_tx_ref.data_is_owned = true;
2601 LDKPublicKey per_commitment_point_ref;
2602 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2603 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2604 LDKHTLCOutputInCommitment htlc_conv;
2605 htlc_conv.inner = (void*)(htlc & (~1));
2606 htlc_conv.is_owned = false;
2607 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2608 *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);
2609 return (long)ret_conv;
2612 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) {
2613 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2614 LDKTransaction closing_tx_ref;
2615 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2616 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2617 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2618 closing_tx_ref.data_is_owned = true;
2619 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2620 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2621 return (long)ret_conv;
2624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2625 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2626 LDKUnsignedChannelAnnouncement msg_conv;
2627 msg_conv.inner = (void*)(msg & (~1));
2628 msg_conv.is_owned = false;
2629 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2630 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2631 return (long)ret_conv;
2634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2635 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2636 LDKChannelTransactionParameters channel_parameters_conv;
2637 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2638 channel_parameters_conv.is_owned = false;
2639 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2643 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2644 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2645 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2646 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2647 CVec_u8Z_free(ret_var);
2651 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2652 if (this_arg->set_pubkeys != NULL)
2653 this_arg->set_pubkeys(this_arg);
2654 return this_arg->pubkeys;
2656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2657 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2658 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2661 long ret_ref = (long)ret_var.inner;
2662 if (ret_var.is_owned) {
2668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2669 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2670 LDKThirtyTwoBytes a_ref;
2671 CHECK((*env)->GetArrayLength(env, a) == 32);
2672 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2674 LDKChannelMonitor b_conv;
2675 b_conv.inner = (void*)(b & (~1));
2676 b_conv.is_owned = (b & 1) || (b == 0);
2677 b_conv = ChannelMonitor_clone(&b_conv);
2681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2682 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2683 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2684 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2688 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2689 LDKChannelMonitor b_var = tuple->b;
2690 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2691 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2692 long b_ref = (long)b_var.inner & ~1;
2695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2696 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2699 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2700 CHECK(val->result_ok);
2701 long res_ref = (long)(&(*val->contents.result)) | 1;
2704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2705 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2706 CHECK(!val->result_ok);
2707 LDKDecodeError err_var = (*val->contents.err);
2708 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2709 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2710 long err_ref = (long)err_var.inner & ~1;
2713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2714 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2717 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2718 CHECK(val->result_ok);
2719 long res_ref = ((long)&(*val->contents.result)) | 1;
2720 return (long)res_ref;
2722 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2723 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2724 CHECK(!val->result_ok);
2725 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2728 static jclass LDKAPIError_APIMisuseError_class = NULL;
2729 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2730 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2731 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2732 static jclass LDKAPIError_RouteError_class = NULL;
2733 static jmethodID LDKAPIError_RouteError_meth = NULL;
2734 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2735 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2736 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2737 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2739 LDKAPIError_APIMisuseError_class =
2740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2741 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2742 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2743 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2744 LDKAPIError_FeeRateTooHigh_class =
2745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2746 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2747 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2748 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2749 LDKAPIError_RouteError_class =
2750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2751 CHECK(LDKAPIError_RouteError_class != NULL);
2752 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2753 CHECK(LDKAPIError_RouteError_meth != NULL);
2754 LDKAPIError_ChannelUnavailable_class =
2755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2756 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2757 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2758 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2759 LDKAPIError_MonitorUpdateFailed_class =
2760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2761 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2762 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2763 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2765 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2766 LDKAPIError *obj = (LDKAPIError*)ptr;
2768 case LDKAPIError_APIMisuseError: {
2769 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2770 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2771 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2772 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2774 case LDKAPIError_FeeRateTooHigh: {
2775 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2776 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2777 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2778 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2780 case LDKAPIError_RouteError: {
2781 LDKStr err_str = obj->route_error.err;
2782 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2783 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2785 case LDKAPIError_ChannelUnavailable: {
2786 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2787 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2788 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2789 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2791 case LDKAPIError_MonitorUpdateFailed: {
2792 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2798 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2801 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2802 CHECK(val->result_ok);
2803 return *val->contents.result;
2805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2806 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2807 CHECK(!val->result_ok);
2808 long err_ref = ((long)&(*val->contents.err)) | 1;
2811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2812 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2813 ret->datalen = (*env)->GetArrayLength(env, elems);
2814 if (ret->datalen == 0) {
2817 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2818 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2819 for (size_t i = 0; i < ret->datalen; i++) {
2820 int64_t arr_elem = java_elems[i];
2821 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2822 FREE((void*)arr_elem);
2823 ret->data[i] = arr_elem_conv;
2825 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2829 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2830 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2831 for (size_t i = 0; i < ret.datalen; i++) {
2832 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2837 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2838 ret->datalen = (*env)->GetArrayLength(env, elems);
2839 if (ret->datalen == 0) {
2842 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2843 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2844 for (size_t i = 0; i < ret->datalen; i++) {
2845 int64_t arr_elem = java_elems[i];
2846 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2847 FREE((void*)arr_elem);
2848 ret->data[i] = arr_elem_conv;
2850 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2854 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2855 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2856 for (size_t i = 0; i < ret.datalen; i++) {
2857 ret.data[i] = APIError_clone(&orig->data[i]);
2861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2862 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2863 ret->datalen = (*env)->GetArrayLength(env, elems);
2864 if (ret->datalen == 0) {
2867 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2868 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2869 for (size_t i = 0; i < ret->datalen; i++) {
2870 int64_t arr_elem = java_elems[i];
2871 LDKChannelDetails arr_elem_conv;
2872 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2873 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2874 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2875 ret->data[i] = arr_elem_conv;
2877 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2881 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2882 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2883 for (size_t i = 0; i < ret.datalen; i++) {
2884 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2888 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
2889 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
2890 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
2891 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
2892 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
2893 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
2894 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
2895 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
2896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
2897 LDKPaymentSendFailure_ParameterError_class =
2898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
2899 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
2900 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "()V");
2901 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
2902 LDKPaymentSendFailure_PathParameterError_class =
2903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
2904 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
2905 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "()V");
2906 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
2907 LDKPaymentSendFailure_AllFailedRetrySafe_class =
2908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
2909 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
2910 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "()V");
2911 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
2912 LDKPaymentSendFailure_PartialFailure_class =
2913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
2914 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
2915 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "()V");
2916 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
2918 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2919 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2921 case LDKPaymentSendFailure_ParameterError: {
2922 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth);
2924 case LDKPaymentSendFailure_PathParameterError: {
2925 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth);
2927 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2928 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth);
2930 case LDKPaymentSendFailure_PartialFailure: {
2931 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth);
2936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2937 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2940 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2941 CHECK(val->result_ok);
2942 return *val->contents.result;
2944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2945 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2946 CHECK(!val->result_ok);
2947 long err_ref = ((long)&(*val->contents.err)) | 1;
2950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2951 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2952 ret->datalen = (*env)->GetArrayLength(env, elems);
2953 if (ret->datalen == 0) {
2956 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2957 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2958 for (size_t i = 0; i < ret->datalen; i++) {
2959 int64_t arr_elem = java_elems[i];
2960 LDKChannelMonitor arr_elem_conv;
2961 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2962 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2963 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2964 ret->data[i] = arr_elem_conv;
2966 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2970 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2971 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2972 for (size_t i = 0; i < ret.datalen; i++) {
2973 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2977 typedef struct LDKWatch_JCalls {
2978 atomic_size_t refcnt;
2981 jmethodID watch_channel_meth;
2982 jmethodID update_channel_meth;
2983 jmethodID release_pending_monitor_events_meth;
2985 static void LDKWatch_JCalls_free(void* this_arg) {
2986 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2987 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2989 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2990 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2994 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2995 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2997 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2998 LDKOutPoint funding_txo_var = funding_txo;
2999 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 long funding_txo_ref = (long)funding_txo_var.inner;
3002 if (funding_txo_var.is_owned) {
3003 funding_txo_ref |= 1;
3005 LDKChannelMonitor monitor_var = monitor;
3006 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 long monitor_ref = (long)monitor_var.inner;
3009 if (monitor_var.is_owned) {
3012 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3014 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3015 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3016 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3019 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3020 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3022 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3023 LDKOutPoint funding_txo_var = funding_txo;
3024 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3025 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3026 long funding_txo_ref = (long)funding_txo_var.inner;
3027 if (funding_txo_var.is_owned) {
3028 funding_txo_ref |= 1;
3030 LDKChannelMonitorUpdate update_var = update;
3031 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3032 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3033 long update_ref = (long)update_var.inner;
3034 if (update_var.is_owned) {
3037 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3039 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3040 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3041 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3044 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
3045 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3047 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3048 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3050 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3051 LDKCVec_MonitorEventZ ret_constr;
3052 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3053 if (ret_constr.datalen > 0)
3054 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3056 ret_constr.data = NULL;
3057 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3058 for (size_t o = 0; o < ret_constr.datalen; o++) {
3059 int64_t ret_conv_14 = ret_vals[o];
3060 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3061 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
3062 ret_constr.data[o] = ret_conv_14_conv;
3064 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3067 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3068 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3069 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3070 return (void*) this_arg;
3072 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3073 jclass c = (*env)->GetObjectClass(env, o);
3075 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3076 atomic_init(&calls->refcnt, 1);
3077 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3078 calls->o = (*env)->NewWeakGlobalRef(env, o);
3079 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3080 CHECK(calls->watch_channel_meth != NULL);
3081 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3082 CHECK(calls->update_channel_meth != NULL);
3083 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3084 CHECK(calls->release_pending_monitor_events_meth != NULL);
3087 .this_arg = (void*) calls,
3088 .watch_channel = watch_channel_jcall,
3089 .update_channel = update_channel_jcall,
3090 .release_pending_monitor_events = release_pending_monitor_events_jcall,
3091 .free = LDKWatch_JCalls_free,
3095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3096 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3097 *res_ptr = LDKWatch_init(env, clz, o);
3098 return (long)res_ptr;
3100 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) {
3101 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3102 LDKOutPoint funding_txo_conv;
3103 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3104 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3105 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3106 LDKChannelMonitor monitor_conv;
3107 monitor_conv.inner = (void*)(monitor & (~1));
3108 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3109 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3110 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3111 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3112 return (long)ret_conv;
3115 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) {
3116 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3117 LDKOutPoint funding_txo_conv;
3118 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3119 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3120 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3121 LDKChannelMonitorUpdate update_conv;
3122 update_conv.inner = (void*)(update & (~1));
3123 update_conv.is_owned = (update & 1) || (update == 0);
3124 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3125 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3126 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3127 return (long)ret_conv;
3130 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3131 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3132 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3133 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3134 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3135 for (size_t o = 0; o < ret_var.datalen; o++) {
3136 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3137 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3138 long ret_conv_14_ref = (long)ret_conv_14_copy;
3139 ret_arr_ptr[o] = ret_conv_14_ref;
3141 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3146 typedef struct LDKBroadcasterInterface_JCalls {
3147 atomic_size_t refcnt;
3150 jmethodID broadcast_transaction_meth;
3151 } LDKBroadcasterInterface_JCalls;
3152 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3153 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3154 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3156 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3157 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3161 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
3162 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3164 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3165 LDKTransaction tx_var = tx;
3166 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3167 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3168 Transaction_free(tx_var);
3169 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3171 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3173 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3174 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3175 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3176 return (void*) this_arg;
3178 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3179 jclass c = (*env)->GetObjectClass(env, o);
3181 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3182 atomic_init(&calls->refcnt, 1);
3183 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3184 calls->o = (*env)->NewWeakGlobalRef(env, o);
3185 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3186 CHECK(calls->broadcast_transaction_meth != NULL);
3188 LDKBroadcasterInterface ret = {
3189 .this_arg = (void*) calls,
3190 .broadcast_transaction = broadcast_transaction_jcall,
3191 .free = LDKBroadcasterInterface_JCalls_free,
3195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3196 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3197 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3198 return (long)res_ptr;
3200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3201 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3202 LDKTransaction tx_ref;
3203 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3204 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3205 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3206 tx_ref.data_is_owned = true;
3207 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3211 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3214 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3215 CHECK(val->result_ok);
3216 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3217 *ret = Sign_clone(&(*val->contents.result));
3220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3221 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3222 CHECK(!val->result_ok);
3223 LDKDecodeError err_var = (*val->contents.err);
3224 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3225 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3226 long err_ref = (long)err_var.inner & ~1;
3229 typedef struct LDKKeysInterface_JCalls {
3230 atomic_size_t refcnt;
3233 jmethodID get_node_secret_meth;
3234 jmethodID get_destination_script_meth;
3235 jmethodID get_shutdown_pubkey_meth;
3236 jmethodID get_channel_signer_meth;
3237 jmethodID get_secure_random_bytes_meth;
3238 jmethodID read_chan_signer_meth;
3239 } LDKKeysInterface_JCalls;
3240 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3241 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3242 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3244 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3245 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3249 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
3250 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3252 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3253 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3255 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3256 LDKSecretKey ret_ref;
3257 CHECK((*env)->GetArrayLength(env, ret) == 32);
3258 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3261 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
3262 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3264 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3265 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3267 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3268 LDKCVec_u8Z ret_ref;
3269 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3270 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3271 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3274 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
3275 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3277 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3278 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3280 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3281 LDKPublicKey ret_ref;
3282 CHECK((*env)->GetArrayLength(env, ret) == 33);
3283 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3286 LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3287 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3289 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3292 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3293 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3294 ret_conv = Sign_clone(ret);
3297 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
3298 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3300 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3301 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3303 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3304 LDKThirtyTwoBytes ret_ref;
3305 CHECK((*env)->GetArrayLength(env, ret) == 32);
3306 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3309 LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
3310 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3312 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3313 LDKu8slice reader_var = reader;
3314 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3315 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3316 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3318 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3319 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3320 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
3323 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3324 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3326 return (void*) this_arg;
3328 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3329 jclass c = (*env)->GetObjectClass(env, o);
3331 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3332 atomic_init(&calls->refcnt, 1);
3333 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3334 calls->o = (*env)->NewWeakGlobalRef(env, o);
3335 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3336 CHECK(calls->get_node_secret_meth != NULL);
3337 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3338 CHECK(calls->get_destination_script_meth != NULL);
3339 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3340 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3341 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3342 CHECK(calls->get_channel_signer_meth != NULL);
3343 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3344 CHECK(calls->get_secure_random_bytes_meth != NULL);
3345 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3346 CHECK(calls->read_chan_signer_meth != NULL);
3348 LDKKeysInterface ret = {
3349 .this_arg = (void*) calls,
3350 .get_node_secret = get_node_secret_jcall,
3351 .get_destination_script = get_destination_script_jcall,
3352 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
3353 .get_channel_signer = get_channel_signer_jcall,
3354 .get_secure_random_bytes = get_secure_random_bytes_jcall,
3355 .read_chan_signer = read_chan_signer_jcall,
3356 .free = LDKKeysInterface_JCalls_free,
3360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3361 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3362 *res_ptr = LDKKeysInterface_init(env, clz, o);
3363 return (long)res_ptr;
3365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3366 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3367 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3368 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3373 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3374 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3375 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3376 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3377 CVec_u8Z_free(ret_var);
3381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(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, 33);
3384 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3388 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) {
3389 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3390 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3391 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3396 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3397 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3398 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3403 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3404 LDKu8slice reader_ref;
3405 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3406 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3407 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3408 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3409 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3410 return (long)ret_conv;
3413 typedef struct LDKFeeEstimator_JCalls {
3414 atomic_size_t refcnt;
3417 jmethodID get_est_sat_per_1000_weight_meth;
3418 } LDKFeeEstimator_JCalls;
3419 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3420 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3421 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3423 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3424 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3428 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3429 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3431 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3432 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3433 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3435 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3437 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3438 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3439 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3440 return (void*) this_arg;
3442 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3443 jclass c = (*env)->GetObjectClass(env, o);
3445 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3446 atomic_init(&calls->refcnt, 1);
3447 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3448 calls->o = (*env)->NewWeakGlobalRef(env, o);
3449 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
3450 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3452 LDKFeeEstimator ret = {
3453 .this_arg = (void*) calls,
3454 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
3455 .free = LDKFeeEstimator_JCalls_free,
3459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3460 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3461 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3462 return (long)res_ptr;
3464 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) {
3465 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3466 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3467 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3471 typedef struct LDKLogger_JCalls {
3472 atomic_size_t refcnt;
3477 static void LDKLogger_JCalls_free(void* this_arg) {
3478 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3479 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3481 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3482 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3486 void log_jcall(const void* this_arg, const char* record) {
3487 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3489 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3490 const char* record_str = record;
3491 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3492 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3494 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3496 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3497 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3498 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3499 return (void*) this_arg;
3501 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3502 jclass c = (*env)->GetObjectClass(env, o);
3504 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3505 atomic_init(&calls->refcnt, 1);
3506 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3507 calls->o = (*env)->NewWeakGlobalRef(env, o);
3508 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3509 CHECK(calls->log_meth != NULL);
3512 .this_arg = (void*) calls,
3514 .free = LDKLogger_JCalls_free,
3518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3519 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3520 *res_ptr = LDKLogger_init(env, clz, o);
3521 return (long)res_ptr;
3523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3524 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3525 LDKThirtyTwoBytes a_ref;
3526 CHECK((*env)->GetArrayLength(env, a) == 32);
3527 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3529 LDKChannelManager b_conv;
3530 b_conv.inner = (void*)(b & (~1));
3531 b_conv.is_owned = (b & 1) || (b == 0);
3532 // Warning: we need a move here but no clone is available for LDKChannelManager
3536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3537 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3538 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3539 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3543 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3544 LDKChannelManager b_var = tuple->b;
3545 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3546 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3547 long b_ref = (long)b_var.inner & ~1;
3550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3551 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3554 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3555 CHECK(val->result_ok);
3556 long res_ref = (long)(&(*val->contents.result)) | 1;
3559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3560 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3561 CHECK(!val->result_ok);
3562 LDKDecodeError err_var = (*val->contents.err);
3563 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3564 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3565 long err_ref = (long)err_var.inner & ~1;
3568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3569 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3572 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3573 CHECK(val->result_ok);
3574 long res_ref = ((long)&(*val->contents.result)) | 1;
3577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3578 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3579 CHECK(!val->result_ok);
3580 LDKDecodeError err_var = (*val->contents.err);
3581 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3582 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3583 long err_ref = (long)err_var.inner & ~1;
3586 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3587 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3588 for (size_t i = 0; i < ret.datalen; i++) {
3589 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3594 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3596 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3597 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3598 CHECK(val->result_ok);
3599 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3600 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3602 for (size_t i = 0; i < res_var.datalen; i++) {
3603 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3604 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3605 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3606 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3611 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3612 CHECK(!val->result_ok);
3613 return *val->contents.err;
3615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3616 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3619 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3620 CHECK(val->result_ok);
3621 LDKInMemorySigner res_var = (*val->contents.result);
3622 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3623 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3624 long res_ref = (long)res_var.inner & ~1;
3627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3628 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3629 CHECK(!val->result_ok);
3630 LDKDecodeError err_var = (*val->contents.err);
3631 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3632 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3633 long err_ref = (long)err_var.inner & ~1;
3636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3637 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3638 ret->datalen = (*env)->GetArrayLength(env, elems);
3639 if (ret->datalen == 0) {
3642 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3643 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3644 for (size_t i = 0; i < ret->datalen; i++) {
3645 int64_t arr_elem = java_elems[i];
3646 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3647 FREE((void*)arr_elem);
3648 ret->data[i] = arr_elem_conv;
3650 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3654 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3655 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3656 for (size_t i = 0; i < ret.datalen; i++) {
3657 ret.data[i] = TxOut_clone(&orig->data[i]);
3661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3662 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3665 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3666 CHECK(val->result_ok);
3667 LDKTransaction res_var = (*val->contents.result);
3668 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3669 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3673 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3674 CHECK(!val->result_ok);
3675 return *val->contents.err;
3677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3678 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3679 ret->datalen = (*env)->GetArrayLength(env, elems);
3680 if (ret->datalen == 0) {
3683 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3684 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3685 for (size_t i = 0; i < ret->datalen; i++) {
3686 int64_t arr_elem = java_elems[i];
3687 LDKRouteHop arr_elem_conv;
3688 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3689 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3690 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3691 ret->data[i] = arr_elem_conv;
3693 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3697 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3698 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3699 for (size_t i = 0; i < ret.datalen; i++) {
3700 ret.data[i] = RouteHop_clone(&orig->data[i]);
3704 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3705 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3706 for (size_t i = 0; i < ret.datalen; i++) {
3707 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3712 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3715 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3716 CHECK(val->result_ok);
3717 LDKRoute res_var = (*val->contents.result);
3718 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3719 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3720 long res_ref = (long)res_var.inner & ~1;
3723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3724 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3725 CHECK(!val->result_ok);
3726 LDKDecodeError err_var = (*val->contents.err);
3727 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3728 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3729 long err_ref = (long)err_var.inner & ~1;
3732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3733 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3734 ret->datalen = (*env)->GetArrayLength(env, elems);
3735 if (ret->datalen == 0) {
3738 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3739 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3740 for (size_t i = 0; i < ret->datalen; i++) {
3741 int64_t arr_elem = java_elems[i];
3742 LDKRouteHint arr_elem_conv;
3743 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3744 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3745 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3746 ret->data[i] = arr_elem_conv;
3748 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3752 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3753 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3754 for (size_t i = 0; i < ret.datalen; i++) {
3755 ret.data[i] = RouteHint_clone(&orig->data[i]);
3759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3760 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3763 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3764 CHECK(val->result_ok);
3765 LDKRoute res_var = (*val->contents.result);
3766 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3767 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3768 long res_ref = (long)res_var.inner & ~1;
3771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3772 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3773 CHECK(!val->result_ok);
3774 LDKLightningError err_var = (*val->contents.err);
3775 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3776 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3777 long err_ref = (long)err_var.inner & ~1;
3780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3781 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3784 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3785 CHECK(val->result_ok);
3786 long res_ref = ((long)&(*val->contents.result)) | 1;
3789 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3790 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3791 CHECK(!val->result_ok);
3792 return *val->contents.err;
3794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3795 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3798 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3799 CHECK(val->result_ok);
3800 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3801 *res_conv = (*val->contents.result);
3802 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3803 return (long)res_conv;
3805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3806 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3807 CHECK(!val->result_ok);
3808 LDKDecodeError err_var = (*val->contents.err);
3809 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3810 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3811 long err_ref = (long)err_var.inner & ~1;
3814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3815 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3816 ret->datalen = (*env)->GetArrayLength(env, elems);
3817 if (ret->datalen == 0) {
3820 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3821 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3822 for (size_t i = 0; i < ret->datalen; i++) {
3823 int64_t arr_elem = java_elems[i];
3824 LDKUpdateAddHTLC arr_elem_conv;
3825 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3826 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3827 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3828 ret->data[i] = arr_elem_conv;
3830 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3834 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3835 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3836 for (size_t i = 0; i < ret.datalen; i++) {
3837 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3842 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3843 ret->datalen = (*env)->GetArrayLength(env, elems);
3844 if (ret->datalen == 0) {
3847 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3848 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3849 for (size_t i = 0; i < ret->datalen; i++) {
3850 int64_t arr_elem = java_elems[i];
3851 LDKUpdateFulfillHTLC arr_elem_conv;
3852 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3853 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3854 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3855 ret->data[i] = arr_elem_conv;
3857 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3861 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3862 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3863 for (size_t i = 0; i < ret.datalen; i++) {
3864 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3869 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3870 ret->datalen = (*env)->GetArrayLength(env, elems);
3871 if (ret->datalen == 0) {
3874 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3875 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3876 for (size_t i = 0; i < ret->datalen; i++) {
3877 int64_t arr_elem = java_elems[i];
3878 LDKUpdateFailHTLC arr_elem_conv;
3879 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3880 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3881 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3882 ret->data[i] = arr_elem_conv;
3884 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3888 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3889 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3890 for (size_t i = 0; i < ret.datalen; i++) {
3891 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3896 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3897 ret->datalen = (*env)->GetArrayLength(env, elems);
3898 if (ret->datalen == 0) {
3901 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3902 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3903 for (size_t i = 0; i < ret->datalen; i++) {
3904 int64_t arr_elem = java_elems[i];
3905 LDKUpdateFailMalformedHTLC arr_elem_conv;
3906 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3907 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3908 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3909 ret->data[i] = arr_elem_conv;
3911 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3915 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3916 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3917 for (size_t i = 0; i < ret.datalen; i++) {
3918 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3923 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3926 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3927 CHECK(val->result_ok);
3928 LDKAcceptChannel res_var = (*val->contents.result);
3929 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3930 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3931 long res_ref = (long)res_var.inner & ~1;
3934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3935 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3936 CHECK(!val->result_ok);
3937 LDKDecodeError err_var = (*val->contents.err);
3938 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3939 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3940 long err_ref = (long)err_var.inner & ~1;
3943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3944 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3947 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3948 CHECK(val->result_ok);
3949 LDKAnnouncementSignatures res_var = (*val->contents.result);
3950 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3951 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3952 long res_ref = (long)res_var.inner & ~1;
3955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3956 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3957 CHECK(!val->result_ok);
3958 LDKDecodeError err_var = (*val->contents.err);
3959 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3960 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3961 long err_ref = (long)err_var.inner & ~1;
3964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3965 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3968 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3969 CHECK(val->result_ok);
3970 LDKChannelReestablish res_var = (*val->contents.result);
3971 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3972 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3973 long res_ref = (long)res_var.inner & ~1;
3976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3977 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3978 CHECK(!val->result_ok);
3979 LDKDecodeError err_var = (*val->contents.err);
3980 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3981 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3982 long err_ref = (long)err_var.inner & ~1;
3985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3986 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3989 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3990 CHECK(val->result_ok);
3991 LDKClosingSigned res_var = (*val->contents.result);
3992 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3993 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3994 long res_ref = (long)res_var.inner & ~1;
3997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3998 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3999 CHECK(!val->result_ok);
4000 LDKDecodeError err_var = (*val->contents.err);
4001 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4002 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4003 long err_ref = (long)err_var.inner & ~1;
4006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4007 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4010 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4011 CHECK(val->result_ok);
4012 LDKCommitmentSigned res_var = (*val->contents.result);
4013 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4014 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4015 long res_ref = (long)res_var.inner & ~1;
4018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4019 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4020 CHECK(!val->result_ok);
4021 LDKDecodeError err_var = (*val->contents.err);
4022 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4023 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4024 long err_ref = (long)err_var.inner & ~1;
4027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4028 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4031 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4032 CHECK(val->result_ok);
4033 LDKFundingCreated res_var = (*val->contents.result);
4034 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4035 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4036 long res_ref = (long)res_var.inner & ~1;
4039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4040 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4041 CHECK(!val->result_ok);
4042 LDKDecodeError err_var = (*val->contents.err);
4043 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 long err_ref = (long)err_var.inner & ~1;
4048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4049 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4052 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4053 CHECK(val->result_ok);
4054 LDKFundingSigned res_var = (*val->contents.result);
4055 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4056 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4057 long res_ref = (long)res_var.inner & ~1;
4060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4061 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4062 CHECK(!val->result_ok);
4063 LDKDecodeError err_var = (*val->contents.err);
4064 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4065 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4066 long err_ref = (long)err_var.inner & ~1;
4069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4070 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4073 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4074 CHECK(val->result_ok);
4075 LDKFundingLocked res_var = (*val->contents.result);
4076 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 long res_ref = (long)res_var.inner & ~1;
4081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4082 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4083 CHECK(!val->result_ok);
4084 LDKDecodeError err_var = (*val->contents.err);
4085 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4086 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4087 long err_ref = (long)err_var.inner & ~1;
4090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4091 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4094 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4095 CHECK(val->result_ok);
4096 LDKInit res_var = (*val->contents.result);
4097 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4098 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4099 long res_ref = (long)res_var.inner & ~1;
4102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4103 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4104 CHECK(!val->result_ok);
4105 LDKDecodeError err_var = (*val->contents.err);
4106 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4107 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4108 long err_ref = (long)err_var.inner & ~1;
4111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4112 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4115 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4116 CHECK(val->result_ok);
4117 LDKOpenChannel res_var = (*val->contents.result);
4118 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 long res_ref = (long)res_var.inner & ~1;
4123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4124 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4125 CHECK(!val->result_ok);
4126 LDKDecodeError err_var = (*val->contents.err);
4127 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4128 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4129 long err_ref = (long)err_var.inner & ~1;
4132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4133 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4136 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4137 CHECK(val->result_ok);
4138 LDKRevokeAndACK res_var = (*val->contents.result);
4139 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4140 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4141 long res_ref = (long)res_var.inner & ~1;
4144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4145 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4146 CHECK(!val->result_ok);
4147 LDKDecodeError err_var = (*val->contents.err);
4148 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4149 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4150 long err_ref = (long)err_var.inner & ~1;
4153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4154 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4157 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4158 CHECK(val->result_ok);
4159 LDKShutdown res_var = (*val->contents.result);
4160 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 long res_ref = (long)res_var.inner & ~1;
4165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4166 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4167 CHECK(!val->result_ok);
4168 LDKDecodeError err_var = (*val->contents.err);
4169 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 long err_ref = (long)err_var.inner & ~1;
4174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4175 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4178 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4179 CHECK(val->result_ok);
4180 LDKUpdateFailHTLC res_var = (*val->contents.result);
4181 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4182 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4183 long res_ref = (long)res_var.inner & ~1;
4186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4187 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4188 CHECK(!val->result_ok);
4189 LDKDecodeError err_var = (*val->contents.err);
4190 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4191 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4192 long err_ref = (long)err_var.inner & ~1;
4195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4196 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4199 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4200 CHECK(val->result_ok);
4201 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4202 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 long res_ref = (long)res_var.inner & ~1;
4207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4208 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4209 CHECK(!val->result_ok);
4210 LDKDecodeError err_var = (*val->contents.err);
4211 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4212 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4213 long err_ref = (long)err_var.inner & ~1;
4216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4217 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4220 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4221 CHECK(val->result_ok);
4222 LDKUpdateFee res_var = (*val->contents.result);
4223 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4224 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 long res_ref = (long)res_var.inner & ~1;
4228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4229 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4230 CHECK(!val->result_ok);
4231 LDKDecodeError err_var = (*val->contents.err);
4232 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 long err_ref = (long)err_var.inner & ~1;
4237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4238 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4241 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4242 CHECK(val->result_ok);
4243 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4244 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4245 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4246 long res_ref = (long)res_var.inner & ~1;
4249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4250 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4251 CHECK(!val->result_ok);
4252 LDKDecodeError err_var = (*val->contents.err);
4253 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4254 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4255 long err_ref = (long)err_var.inner & ~1;
4258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4259 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4262 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4263 CHECK(val->result_ok);
4264 LDKUpdateAddHTLC res_var = (*val->contents.result);
4265 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4266 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4267 long res_ref = (long)res_var.inner & ~1;
4270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4271 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4272 CHECK(!val->result_ok);
4273 LDKDecodeError err_var = (*val->contents.err);
4274 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4275 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4276 long err_ref = (long)err_var.inner & ~1;
4279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4280 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4283 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4284 CHECK(val->result_ok);
4285 LDKPing res_var = (*val->contents.result);
4286 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 long res_ref = (long)res_var.inner & ~1;
4291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4292 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4293 CHECK(!val->result_ok);
4294 LDKDecodeError err_var = (*val->contents.err);
4295 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4296 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4297 long err_ref = (long)err_var.inner & ~1;
4300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4301 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4304 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4305 CHECK(val->result_ok);
4306 LDKPong res_var = (*val->contents.result);
4307 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4308 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4309 long res_ref = (long)res_var.inner & ~1;
4312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4313 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4314 CHECK(!val->result_ok);
4315 LDKDecodeError err_var = (*val->contents.err);
4316 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4317 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4318 long err_ref = (long)err_var.inner & ~1;
4321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4322 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4325 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4326 CHECK(val->result_ok);
4327 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4328 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4329 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4330 long res_ref = (long)res_var.inner & ~1;
4333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4334 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4335 CHECK(!val->result_ok);
4336 LDKDecodeError err_var = (*val->contents.err);
4337 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4338 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4339 long err_ref = (long)err_var.inner & ~1;
4342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4343 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4346 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4347 CHECK(val->result_ok);
4348 LDKChannelAnnouncement res_var = (*val->contents.result);
4349 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4350 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4351 long res_ref = (long)res_var.inner & ~1;
4354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4355 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4356 CHECK(!val->result_ok);
4357 LDKDecodeError err_var = (*val->contents.err);
4358 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 long err_ref = (long)err_var.inner & ~1;
4363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4364 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4367 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4368 CHECK(val->result_ok);
4369 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4370 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4371 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4372 long res_ref = (long)res_var.inner & ~1;
4375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4376 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4377 CHECK(!val->result_ok);
4378 LDKDecodeError err_var = (*val->contents.err);
4379 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4380 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4381 long err_ref = (long)err_var.inner & ~1;
4384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4385 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4388 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4389 CHECK(val->result_ok);
4390 LDKChannelUpdate res_var = (*val->contents.result);
4391 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 long res_ref = (long)res_var.inner & ~1;
4396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4397 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4398 CHECK(!val->result_ok);
4399 LDKDecodeError err_var = (*val->contents.err);
4400 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 long err_ref = (long)err_var.inner & ~1;
4405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4406 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4409 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4410 CHECK(val->result_ok);
4411 LDKErrorMessage res_var = (*val->contents.result);
4412 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 long res_ref = (long)res_var.inner & ~1;
4417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4418 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4419 CHECK(!val->result_ok);
4420 LDKDecodeError err_var = (*val->contents.err);
4421 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 long err_ref = (long)err_var.inner & ~1;
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4427 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4430 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4431 CHECK(val->result_ok);
4432 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4433 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 long res_ref = (long)res_var.inner & ~1;
4438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4439 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4440 CHECK(!val->result_ok);
4441 LDKDecodeError err_var = (*val->contents.err);
4442 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4443 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4444 long err_ref = (long)err_var.inner & ~1;
4447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4448 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4451 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4452 CHECK(val->result_ok);
4453 LDKNodeAnnouncement res_var = (*val->contents.result);
4454 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4455 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4456 long res_ref = (long)res_var.inner & ~1;
4459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4460 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4461 CHECK(!val->result_ok);
4462 LDKDecodeError err_var = (*val->contents.err);
4463 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 long err_ref = (long)err_var.inner & ~1;
4468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4469 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4472 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4473 CHECK(val->result_ok);
4474 LDKQueryShortChannelIds res_var = (*val->contents.result);
4475 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4476 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4477 long res_ref = (long)res_var.inner & ~1;
4480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4481 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4482 CHECK(!val->result_ok);
4483 LDKDecodeError err_var = (*val->contents.err);
4484 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4485 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4486 long err_ref = (long)err_var.inner & ~1;
4489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4490 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4493 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4494 CHECK(val->result_ok);
4495 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4496 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4497 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4498 long res_ref = (long)res_var.inner & ~1;
4501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4502 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4503 CHECK(!val->result_ok);
4504 LDKDecodeError err_var = (*val->contents.err);
4505 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4506 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4507 long err_ref = (long)err_var.inner & ~1;
4510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4511 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4514 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4515 CHECK(val->result_ok);
4516 LDKQueryChannelRange res_var = (*val->contents.result);
4517 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4518 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4519 long res_ref = (long)res_var.inner & ~1;
4522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4523 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4524 CHECK(!val->result_ok);
4525 LDKDecodeError err_var = (*val->contents.err);
4526 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4527 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4528 long err_ref = (long)err_var.inner & ~1;
4531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4532 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4535 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4536 CHECK(val->result_ok);
4537 LDKReplyChannelRange res_var = (*val->contents.result);
4538 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4539 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4540 long res_ref = (long)res_var.inner & ~1;
4543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4544 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4545 CHECK(!val->result_ok);
4546 LDKDecodeError err_var = (*val->contents.err);
4547 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4548 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4549 long err_ref = (long)err_var.inner & ~1;
4552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4553 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4556 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4557 CHECK(val->result_ok);
4558 LDKGossipTimestampFilter res_var = (*val->contents.result);
4559 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4560 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4561 long res_ref = (long)res_var.inner & ~1;
4564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4565 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4566 CHECK(!val->result_ok);
4567 LDKDecodeError err_var = (*val->contents.err);
4568 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4569 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4570 long err_ref = (long)err_var.inner & ~1;
4573 typedef struct LDKMessageSendEventsProvider_JCalls {
4574 atomic_size_t refcnt;
4577 jmethodID get_and_clear_pending_msg_events_meth;
4578 } LDKMessageSendEventsProvider_JCalls;
4579 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4580 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4581 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4583 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4584 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4588 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
4589 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4591 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4592 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4594 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
4595 LDKCVec_MessageSendEventZ ret_constr;
4596 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4597 if (ret_constr.datalen > 0)
4598 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4600 ret_constr.data = NULL;
4601 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4602 for (size_t s = 0; s < ret_constr.datalen; s++) {
4603 int64_t ret_conv_18 = ret_vals[s];
4604 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4605 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
4606 ret_constr.data[s] = ret_conv_18_conv;
4608 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4611 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4612 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4613 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4614 return (void*) this_arg;
4616 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4617 jclass c = (*env)->GetObjectClass(env, o);
4619 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4620 atomic_init(&calls->refcnt, 1);
4621 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4622 calls->o = (*env)->NewWeakGlobalRef(env, o);
4623 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
4624 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
4626 LDKMessageSendEventsProvider ret = {
4627 .this_arg = (void*) calls,
4628 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
4629 .free = LDKMessageSendEventsProvider_JCalls_free,
4633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4634 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4635 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
4636 return (long)res_ptr;
4638 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4639 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4640 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4641 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4642 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4643 for (size_t s = 0; s < ret_var.datalen; s++) {
4644 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4645 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4646 long ret_conv_18_ref = (long)ret_conv_18_copy;
4647 ret_arr_ptr[s] = ret_conv_18_ref;
4649 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4654 typedef struct LDKEventsProvider_JCalls {
4655 atomic_size_t refcnt;
4658 jmethodID get_and_clear_pending_events_meth;
4659 } LDKEventsProvider_JCalls;
4660 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4661 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4662 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4664 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4665 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4669 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
4670 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4672 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4673 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4675 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
4676 LDKCVec_EventZ ret_constr;
4677 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4678 if (ret_constr.datalen > 0)
4679 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4681 ret_constr.data = NULL;
4682 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4683 for (size_t h = 0; h < ret_constr.datalen; h++) {
4684 int64_t ret_conv_7 = ret_vals[h];
4685 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4686 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
4687 ret_constr.data[h] = ret_conv_7_conv;
4689 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4692 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4693 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4694 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4695 return (void*) this_arg;
4697 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4698 jclass c = (*env)->GetObjectClass(env, o);
4700 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4701 atomic_init(&calls->refcnt, 1);
4702 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4703 calls->o = (*env)->NewWeakGlobalRef(env, o);
4704 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
4705 CHECK(calls->get_and_clear_pending_events_meth != NULL);
4707 LDKEventsProvider ret = {
4708 .this_arg = (void*) calls,
4709 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
4710 .free = LDKEventsProvider_JCalls_free,
4714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4715 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4716 *res_ptr = LDKEventsProvider_init(env, clz, o);
4717 return (long)res_ptr;
4719 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4720 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4721 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4722 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4723 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4724 for (size_t h = 0; h < ret_var.datalen; h++) {
4725 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4726 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4727 long ret_conv_7_ref = (long)ret_conv_7_copy;
4728 ret_arr_ptr[h] = ret_conv_7_ref;
4730 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4735 typedef struct LDKAccess_JCalls {
4736 atomic_size_t refcnt;
4739 jmethodID get_utxo_meth;
4741 static void LDKAccess_JCalls_free(void* this_arg) {
4742 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4743 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4746 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4750 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4751 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4753 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4754 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4755 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4756 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4758 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4759 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4760 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4763 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4764 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4765 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4766 return (void*) this_arg;
4768 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4769 jclass c = (*env)->GetObjectClass(env, o);
4771 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4772 atomic_init(&calls->refcnt, 1);
4773 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4774 calls->o = (*env)->NewWeakGlobalRef(env, o);
4775 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4776 CHECK(calls->get_utxo_meth != NULL);
4779 .this_arg = (void*) calls,
4780 .get_utxo = get_utxo_jcall,
4781 .free = LDKAccess_JCalls_free,
4785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4786 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4787 *res_ptr = LDKAccess_init(env, clz, o);
4788 return (long)res_ptr;
4790 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) {
4791 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4792 unsigned char genesis_hash_arr[32];
4793 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4794 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4795 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4796 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4797 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4798 return (long)ret_conv;
4801 typedef struct LDKListen_JCalls {
4802 atomic_size_t refcnt;
4805 jmethodID block_connected_meth;
4806 jmethodID block_disconnected_meth;
4808 static void LDKListen_JCalls_free(void* this_arg) {
4809 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4810 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4812 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4813 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4817 void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4818 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4820 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4821 LDKu8slice block_var = block;
4822 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
4823 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
4824 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4826 return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
4828 void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4829 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4831 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4832 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
4833 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
4834 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4836 return (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
4838 static void* LDKListen_JCalls_clone(const void* this_arg) {
4839 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4840 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4841 return (void*) this_arg;
4843 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
4844 jclass c = (*env)->GetObjectClass(env, o);
4846 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4847 atomic_init(&calls->refcnt, 1);
4848 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4849 calls->o = (*env)->NewWeakGlobalRef(env, o);
4850 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
4851 CHECK(calls->block_connected_meth != NULL);
4852 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
4853 CHECK(calls->block_disconnected_meth != NULL);
4856 .this_arg = (void*) calls,
4857 .block_connected = block_connected_jcall,
4858 .block_disconnected = block_disconnected_jcall,
4859 .free = LDKListen_JCalls_free,
4863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
4864 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4865 *res_ptr = LDKListen_init(env, clz, o);
4866 return (long)res_ptr;
4868 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) {
4869 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4870 LDKu8slice block_ref;
4871 block_ref.datalen = (*env)->GetArrayLength(env, block);
4872 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
4873 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4874 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
4877 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) {
4878 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4879 unsigned char header_arr[80];
4880 CHECK((*env)->GetArrayLength(env, header) == 80);
4881 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
4882 unsigned char (*header_ref)[80] = &header_arr;
4883 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4886 typedef struct LDKFilter_JCalls {
4887 atomic_size_t refcnt;
4890 jmethodID register_tx_meth;
4891 jmethodID register_output_meth;
4893 static void LDKFilter_JCalls_free(void* this_arg) {
4894 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4895 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4897 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4898 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4902 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4903 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4905 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4906 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4907 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4908 LDKu8slice script_pubkey_var = script_pubkey;
4909 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4910 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4911 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4913 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4915 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4916 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4918 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4919 LDKOutPoint outpoint_var = *outpoint;
4920 outpoint_var = OutPoint_clone(outpoint);
4921 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4922 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4923 long outpoint_ref = (long)outpoint_var.inner;
4924 if (outpoint_var.is_owned) {
4927 LDKu8slice script_pubkey_var = script_pubkey;
4928 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4929 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4932 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4934 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4935 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4936 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4937 return (void*) this_arg;
4939 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4940 jclass c = (*env)->GetObjectClass(env, o);
4942 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4943 atomic_init(&calls->refcnt, 1);
4944 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4945 calls->o = (*env)->NewWeakGlobalRef(env, o);
4946 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4947 CHECK(calls->register_tx_meth != NULL);
4948 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4949 CHECK(calls->register_output_meth != NULL);
4952 .this_arg = (void*) calls,
4953 .register_tx = register_tx_jcall,
4954 .register_output = register_output_jcall,
4955 .free = LDKFilter_JCalls_free,
4959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4960 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4961 *res_ptr = LDKFilter_init(env, clz, o);
4962 return (long)res_ptr;
4964 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) {
4965 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4966 unsigned char txid_arr[32];
4967 CHECK((*env)->GetArrayLength(env, txid) == 32);
4968 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4969 unsigned char (*txid_ref)[32] = &txid_arr;
4970 LDKu8slice script_pubkey_ref;
4971 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4972 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4973 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4974 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4977 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) {
4978 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4979 LDKOutPoint outpoint_conv;
4980 outpoint_conv.inner = (void*)(outpoint & (~1));
4981 outpoint_conv.is_owned = false;
4982 LDKu8slice script_pubkey_ref;
4983 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4984 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4985 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4986 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4989 typedef struct LDKPersist_JCalls {
4990 atomic_size_t refcnt;
4993 jmethodID persist_new_channel_meth;
4994 jmethodID update_persisted_channel_meth;
4995 } LDKPersist_JCalls;
4996 static void LDKPersist_JCalls_free(void* this_arg) {
4997 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4998 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5000 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5001 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5005 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5006 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5008 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5009 LDKOutPoint id_var = id;
5010 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5011 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5012 long id_ref = (long)id_var.inner;
5013 if (id_var.is_owned) {
5016 LDKChannelMonitor data_var = *data;
5017 data_var = ChannelMonitor_clone(data);
5018 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5019 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5020 long data_ref = (long)data_var.inner;
5021 if (data_var.is_owned) {
5024 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5026 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
5027 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5028 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5031 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5032 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5034 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5035 LDKOutPoint id_var = id;
5036 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5037 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5038 long id_ref = (long)id_var.inner;
5039 if (id_var.is_owned) {
5042 LDKChannelMonitorUpdate update_var = *update;
5043 update_var = ChannelMonitorUpdate_clone(update);
5044 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5045 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5046 long update_ref = (long)update_var.inner;
5047 if (update_var.is_owned) {
5050 LDKChannelMonitor data_var = *data;
5051 data_var = ChannelMonitor_clone(data);
5052 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5053 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5054 long data_ref = (long)data_var.inner;
5055 if (data_var.is_owned) {
5058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5060 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5061 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5062 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5065 static void* LDKPersist_JCalls_clone(const void* this_arg) {
5066 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5067 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5068 return (void*) this_arg;
5070 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
5071 jclass c = (*env)->GetObjectClass(env, o);
5073 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5074 atomic_init(&calls->refcnt, 1);
5075 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5076 calls->o = (*env)->NewWeakGlobalRef(env, o);
5077 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
5078 CHECK(calls->persist_new_channel_meth != NULL);
5079 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
5080 CHECK(calls->update_persisted_channel_meth != NULL);
5083 .this_arg = (void*) calls,
5084 .persist_new_channel = persist_new_channel_jcall,
5085 .update_persisted_channel = update_persisted_channel_jcall,
5086 .free = LDKPersist_JCalls_free,
5090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
5091 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5092 *res_ptr = LDKPersist_init(env, clz, o);
5093 return (long)res_ptr;
5095 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) {
5096 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5097 LDKOutPoint id_conv;
5098 id_conv.inner = (void*)(id & (~1));
5099 id_conv.is_owned = (id & 1) || (id == 0);
5100 id_conv = OutPoint_clone(&id_conv);
5101 LDKChannelMonitor data_conv;
5102 data_conv.inner = (void*)(data & (~1));
5103 data_conv.is_owned = false;
5104 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5105 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5106 return (long)ret_conv;
5109 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) {
5110 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5111 LDKOutPoint id_conv;
5112 id_conv.inner = (void*)(id & (~1));
5113 id_conv.is_owned = (id & 1) || (id == 0);
5114 id_conv = OutPoint_clone(&id_conv);
5115 LDKChannelMonitorUpdate update_conv;
5116 update_conv.inner = (void*)(update & (~1));
5117 update_conv.is_owned = false;
5118 LDKChannelMonitor data_conv;
5119 data_conv.inner = (void*)(data & (~1));
5120 data_conv.is_owned = false;
5121 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5122 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5123 return (long)ret_conv;
5126 typedef struct LDKChannelMessageHandler_JCalls {
5127 atomic_size_t refcnt;
5130 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5131 jmethodID handle_open_channel_meth;
5132 jmethodID handle_accept_channel_meth;
5133 jmethodID handle_funding_created_meth;
5134 jmethodID handle_funding_signed_meth;
5135 jmethodID handle_funding_locked_meth;
5136 jmethodID handle_shutdown_meth;
5137 jmethodID handle_closing_signed_meth;
5138 jmethodID handle_update_add_htlc_meth;
5139 jmethodID handle_update_fulfill_htlc_meth;
5140 jmethodID handle_update_fail_htlc_meth;
5141 jmethodID handle_update_fail_malformed_htlc_meth;
5142 jmethodID handle_commitment_signed_meth;
5143 jmethodID handle_revoke_and_ack_meth;
5144 jmethodID handle_update_fee_meth;
5145 jmethodID handle_announcement_signatures_meth;
5146 jmethodID peer_disconnected_meth;
5147 jmethodID peer_connected_meth;
5148 jmethodID handle_channel_reestablish_meth;
5149 jmethodID handle_error_meth;
5150 } LDKChannelMessageHandler_JCalls;
5151 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5152 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5153 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5155 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5156 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5160 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5161 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5163 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5164 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5165 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5166 LDKInitFeatures their_features_var = their_features;
5167 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5168 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5169 long their_features_ref = (long)their_features_var.inner;
5170 if (their_features_var.is_owned) {
5171 their_features_ref |= 1;
5173 LDKOpenChannel msg_var = *msg;
5174 msg_var = OpenChannel_clone(msg);
5175 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5176 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5177 long msg_ref = (long)msg_var.inner;
5178 if (msg_var.is_owned) {
5181 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5183 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5185 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5186 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5188 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5189 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5190 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5191 LDKInitFeatures their_features_var = their_features;
5192 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5193 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5194 long their_features_ref = (long)their_features_var.inner;
5195 if (their_features_var.is_owned) {
5196 their_features_ref |= 1;
5198 LDKAcceptChannel msg_var = *msg;
5199 msg_var = AcceptChannel_clone(msg);
5200 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5201 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5202 long msg_ref = (long)msg_var.inner;
5203 if (msg_var.is_owned) {
5206 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5208 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5210 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5211 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5213 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5214 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5215 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5216 LDKFundingCreated msg_var = *msg;
5217 msg_var = FundingCreated_clone(msg);
5218 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5219 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5220 long msg_ref = (long)msg_var.inner;
5221 if (msg_var.is_owned) {
5224 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5226 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5228 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5229 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5231 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5232 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5233 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5234 LDKFundingSigned msg_var = *msg;
5235 msg_var = FundingSigned_clone(msg);
5236 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5237 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5238 long msg_ref = (long)msg_var.inner;
5239 if (msg_var.is_owned) {
5242 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5244 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5246 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5247 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5249 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5250 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5251 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5252 LDKFundingLocked msg_var = *msg;
5253 msg_var = FundingLocked_clone(msg);
5254 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5255 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5256 long msg_ref = (long)msg_var.inner;
5257 if (msg_var.is_owned) {
5260 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5262 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5264 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5265 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5267 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5268 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5269 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5270 LDKInitFeatures their_features_var = *their_features;
5271 their_features_var = InitFeatures_clone(their_features);
5272 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5273 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5274 long their_features_ref = (long)their_features_var.inner;
5275 if (their_features_var.is_owned) {
5276 their_features_ref |= 1;
5278 LDKShutdown msg_var = *msg;
5279 msg_var = Shutdown_clone(msg);
5280 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5281 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5282 long msg_ref = (long)msg_var.inner;
5283 if (msg_var.is_owned) {
5286 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5288 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5290 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5291 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5294 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5295 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5296 LDKClosingSigned msg_var = *msg;
5297 msg_var = ClosingSigned_clone(msg);
5298 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5299 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5300 long msg_ref = (long)msg_var.inner;
5301 if (msg_var.is_owned) {
5304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5306 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5308 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5309 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5311 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5312 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5313 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5314 LDKUpdateAddHTLC msg_var = *msg;
5315 msg_var = UpdateAddHTLC_clone(msg);
5316 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5317 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5318 long msg_ref = (long)msg_var.inner;
5319 if (msg_var.is_owned) {
5322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5324 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5326 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5327 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5329 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5330 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5331 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5332 LDKUpdateFulfillHTLC msg_var = *msg;
5333 msg_var = UpdateFulfillHTLC_clone(msg);
5334 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5335 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5336 long msg_ref = (long)msg_var.inner;
5337 if (msg_var.is_owned) {
5340 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5342 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5344 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5345 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5347 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5348 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5349 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5350 LDKUpdateFailHTLC msg_var = *msg;
5351 msg_var = UpdateFailHTLC_clone(msg);
5352 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5353 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5354 long msg_ref = (long)msg_var.inner;
5355 if (msg_var.is_owned) {
5358 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5360 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5362 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5363 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5365 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5366 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5367 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5368 LDKUpdateFailMalformedHTLC msg_var = *msg;
5369 msg_var = UpdateFailMalformedHTLC_clone(msg);
5370 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5371 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5372 long msg_ref = (long)msg_var.inner;
5373 if (msg_var.is_owned) {
5376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5378 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5380 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5381 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5383 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5384 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5385 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5386 LDKCommitmentSigned msg_var = *msg;
5387 msg_var = CommitmentSigned_clone(msg);
5388 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5389 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5390 long msg_ref = (long)msg_var.inner;
5391 if (msg_var.is_owned) {
5394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5396 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5398 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5399 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5401 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5402 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5403 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5404 LDKRevokeAndACK msg_var = *msg;
5405 msg_var = RevokeAndACK_clone(msg);
5406 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5407 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5408 long msg_ref = (long)msg_var.inner;
5409 if (msg_var.is_owned) {
5412 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5414 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5416 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5417 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5419 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5420 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5421 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5422 LDKUpdateFee msg_var = *msg;
5423 msg_var = UpdateFee_clone(msg);
5424 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5425 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5426 long msg_ref = (long)msg_var.inner;
5427 if (msg_var.is_owned) {
5430 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5432 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5434 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5435 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5437 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5438 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5439 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5440 LDKAnnouncementSignatures msg_var = *msg;
5441 msg_var = AnnouncementSignatures_clone(msg);
5442 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5443 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5444 long msg_ref = (long)msg_var.inner;
5445 if (msg_var.is_owned) {
5448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5450 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5452 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5453 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5455 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5456 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5457 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5458 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5460 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5462 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5463 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5466 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5467 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5468 LDKInit msg_var = *msg;
5469 msg_var = Init_clone(msg);
5470 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5471 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5472 long msg_ref = (long)msg_var.inner;
5473 if (msg_var.is_owned) {
5476 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5478 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5480 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5481 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5483 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5484 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5485 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5486 LDKChannelReestablish msg_var = *msg;
5487 msg_var = ChannelReestablish_clone(msg);
5488 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5489 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5490 long msg_ref = (long)msg_var.inner;
5491 if (msg_var.is_owned) {
5494 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5496 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5498 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5499 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5501 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5502 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5503 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5504 LDKErrorMessage msg_var = *msg;
5505 msg_var = ErrorMessage_clone(msg);
5506 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5507 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5508 long msg_ref = (long)msg_var.inner;
5509 if (msg_var.is_owned) {
5512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5514 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5516 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
5517 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5518 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5519 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5520 return (void*) this_arg;
5522 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5523 jclass c = (*env)->GetObjectClass(env, o);
5525 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5526 atomic_init(&calls->refcnt, 1);
5527 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5528 calls->o = (*env)->NewWeakGlobalRef(env, o);
5529 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
5530 CHECK(calls->handle_open_channel_meth != NULL);
5531 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
5532 CHECK(calls->handle_accept_channel_meth != NULL);
5533 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
5534 CHECK(calls->handle_funding_created_meth != NULL);
5535 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
5536 CHECK(calls->handle_funding_signed_meth != NULL);
5537 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
5538 CHECK(calls->handle_funding_locked_meth != NULL);
5539 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
5540 CHECK(calls->handle_shutdown_meth != NULL);
5541 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
5542 CHECK(calls->handle_closing_signed_meth != NULL);
5543 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
5544 CHECK(calls->handle_update_add_htlc_meth != NULL);
5545 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
5546 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
5547 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
5548 CHECK(calls->handle_update_fail_htlc_meth != NULL);
5549 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
5550 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
5551 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
5552 CHECK(calls->handle_commitment_signed_meth != NULL);
5553 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
5554 CHECK(calls->handle_revoke_and_ack_meth != NULL);
5555 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
5556 CHECK(calls->handle_update_fee_meth != NULL);
5557 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
5558 CHECK(calls->handle_announcement_signatures_meth != NULL);
5559 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
5560 CHECK(calls->peer_disconnected_meth != NULL);
5561 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
5562 CHECK(calls->peer_connected_meth != NULL);
5563 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
5564 CHECK(calls->handle_channel_reestablish_meth != NULL);
5565 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
5566 CHECK(calls->handle_error_meth != NULL);
5568 LDKChannelMessageHandler ret = {
5569 .this_arg = (void*) calls,
5570 .handle_open_channel = handle_open_channel_jcall,
5571 .handle_accept_channel = handle_accept_channel_jcall,
5572 .handle_funding_created = handle_funding_created_jcall,
5573 .handle_funding_signed = handle_funding_signed_jcall,
5574 .handle_funding_locked = handle_funding_locked_jcall,
5575 .handle_shutdown = handle_shutdown_jcall,
5576 .handle_closing_signed = handle_closing_signed_jcall,
5577 .handle_update_add_htlc = handle_update_add_htlc_jcall,
5578 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
5579 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
5580 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
5581 .handle_commitment_signed = handle_commitment_signed_jcall,
5582 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
5583 .handle_update_fee = handle_update_fee_jcall,
5584 .handle_announcement_signatures = handle_announcement_signatures_jcall,
5585 .peer_disconnected = peer_disconnected_jcall,
5586 .peer_connected = peer_connected_jcall,
5587 .handle_channel_reestablish = handle_channel_reestablish_jcall,
5588 .handle_error = handle_error_jcall,
5589 .free = LDKChannelMessageHandler_JCalls_free,
5590 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5592 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5596 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5597 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5598 return (long)res_ptr;
5600 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) {
5601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5602 LDKPublicKey their_node_id_ref;
5603 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5604 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5605 LDKInitFeatures their_features_conv;
5606 their_features_conv.inner = (void*)(their_features & (~1));
5607 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5608 their_features_conv = InitFeatures_clone(&their_features_conv);
5609 LDKOpenChannel msg_conv;
5610 msg_conv.inner = (void*)(msg & (~1));
5611 msg_conv.is_owned = false;
5612 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5615 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) {
5616 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5617 LDKPublicKey their_node_id_ref;
5618 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5619 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5620 LDKInitFeatures their_features_conv;
5621 their_features_conv.inner = (void*)(their_features & (~1));
5622 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5623 their_features_conv = InitFeatures_clone(&their_features_conv);
5624 LDKAcceptChannel msg_conv;
5625 msg_conv.inner = (void*)(msg & (~1));
5626 msg_conv.is_owned = false;
5627 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5630 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) {
5631 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5632 LDKPublicKey their_node_id_ref;
5633 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5634 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5635 LDKFundingCreated msg_conv;
5636 msg_conv.inner = (void*)(msg & (~1));
5637 msg_conv.is_owned = false;
5638 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5641 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) {
5642 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5643 LDKPublicKey their_node_id_ref;
5644 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5645 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5646 LDKFundingSigned msg_conv;
5647 msg_conv.inner = (void*)(msg & (~1));
5648 msg_conv.is_owned = false;
5649 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5652 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) {
5653 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5654 LDKPublicKey their_node_id_ref;
5655 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5656 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5657 LDKFundingLocked msg_conv;
5658 msg_conv.inner = (void*)(msg & (~1));
5659 msg_conv.is_owned = false;
5660 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5663 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) {
5664 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5665 LDKPublicKey their_node_id_ref;
5666 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5667 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5668 LDKInitFeatures their_features_conv;
5669 their_features_conv.inner = (void*)(their_features & (~1));
5670 their_features_conv.is_owned = false;
5671 LDKShutdown msg_conv;
5672 msg_conv.inner = (void*)(msg & (~1));
5673 msg_conv.is_owned = false;
5674 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5677 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) {
5678 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5679 LDKPublicKey their_node_id_ref;
5680 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5681 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5682 LDKClosingSigned msg_conv;
5683 msg_conv.inner = (void*)(msg & (~1));
5684 msg_conv.is_owned = false;
5685 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5688 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) {
5689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5690 LDKPublicKey their_node_id_ref;
5691 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5692 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5693 LDKUpdateAddHTLC msg_conv;
5694 msg_conv.inner = (void*)(msg & (~1));
5695 msg_conv.is_owned = false;
5696 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5699 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) {
5700 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5701 LDKPublicKey their_node_id_ref;
5702 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5703 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5704 LDKUpdateFulfillHTLC msg_conv;
5705 msg_conv.inner = (void*)(msg & (~1));
5706 msg_conv.is_owned = false;
5707 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5710 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) {
5711 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5712 LDKPublicKey their_node_id_ref;
5713 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5714 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5715 LDKUpdateFailHTLC msg_conv;
5716 msg_conv.inner = (void*)(msg & (~1));
5717 msg_conv.is_owned = false;
5718 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5721 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) {
5722 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5723 LDKPublicKey their_node_id_ref;
5724 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5725 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5726 LDKUpdateFailMalformedHTLC msg_conv;
5727 msg_conv.inner = (void*)(msg & (~1));
5728 msg_conv.is_owned = false;
5729 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5732 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) {
5733 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5734 LDKPublicKey their_node_id_ref;
5735 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5736 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5737 LDKCommitmentSigned msg_conv;
5738 msg_conv.inner = (void*)(msg & (~1));
5739 msg_conv.is_owned = false;
5740 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5743 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) {
5744 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5745 LDKPublicKey their_node_id_ref;
5746 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5747 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5748 LDKRevokeAndACK msg_conv;
5749 msg_conv.inner = (void*)(msg & (~1));
5750 msg_conv.is_owned = false;
5751 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5754 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) {
5755 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5756 LDKPublicKey their_node_id_ref;
5757 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5758 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5759 LDKUpdateFee msg_conv;
5760 msg_conv.inner = (void*)(msg & (~1));
5761 msg_conv.is_owned = false;
5762 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5765 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) {
5766 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5767 LDKPublicKey their_node_id_ref;
5768 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5769 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5770 LDKAnnouncementSignatures msg_conv;
5771 msg_conv.inner = (void*)(msg & (~1));
5772 msg_conv.is_owned = false;
5773 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5776 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) {
5777 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5778 LDKPublicKey their_node_id_ref;
5779 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5780 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5781 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5784 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) {
5785 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5786 LDKPublicKey their_node_id_ref;
5787 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5788 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5790 msg_conv.inner = (void*)(msg & (~1));
5791 msg_conv.is_owned = false;
5792 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5795 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) {
5796 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5797 LDKPublicKey their_node_id_ref;
5798 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5799 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5800 LDKChannelReestablish msg_conv;
5801 msg_conv.inner = (void*)(msg & (~1));
5802 msg_conv.is_owned = false;
5803 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5806 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) {
5807 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5808 LDKPublicKey their_node_id_ref;
5809 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5810 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5811 LDKErrorMessage msg_conv;
5812 msg_conv.inner = (void*)(msg & (~1));
5813 msg_conv.is_owned = false;
5814 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5817 typedef struct LDKRoutingMessageHandler_JCalls {
5818 atomic_size_t refcnt;
5821 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5822 jmethodID handle_node_announcement_meth;
5823 jmethodID handle_channel_announcement_meth;
5824 jmethodID handle_channel_update_meth;
5825 jmethodID handle_htlc_fail_channel_update_meth;
5826 jmethodID get_next_channel_announcements_meth;
5827 jmethodID get_next_node_announcements_meth;
5828 jmethodID sync_routing_table_meth;
5829 jmethodID handle_reply_channel_range_meth;
5830 jmethodID handle_reply_short_channel_ids_end_meth;
5831 jmethodID handle_query_channel_range_meth;
5832 jmethodID handle_query_short_channel_ids_meth;
5833 } LDKRoutingMessageHandler_JCalls;
5834 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5835 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5836 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5838 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5839 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5843 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5844 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5846 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5847 LDKNodeAnnouncement msg_var = *msg;
5848 msg_var = NodeAnnouncement_clone(msg);
5849 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5850 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5851 long msg_ref = (long)msg_var.inner;
5852 if (msg_var.is_owned) {
5855 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5857 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5858 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5859 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5862 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5863 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5865 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5866 LDKChannelAnnouncement msg_var = *msg;
5867 msg_var = ChannelAnnouncement_clone(msg);
5868 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5869 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5870 long msg_ref = (long)msg_var.inner;
5871 if (msg_var.is_owned) {
5874 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5876 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5877 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5878 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5881 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5882 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5884 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5885 LDKChannelUpdate msg_var = *msg;
5886 msg_var = ChannelUpdate_clone(msg);
5887 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5888 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5889 long msg_ref = (long)msg_var.inner;
5890 if (msg_var.is_owned) {
5893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5895 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5896 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5897 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5900 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5901 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5903 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5904 long ret_update = (long)update;
5905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5907 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5909 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5910 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5912 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5913 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5915 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5916 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5917 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5918 if (ret_constr.datalen > 0)
5919 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5921 ret_constr.data = NULL;
5922 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5923 for (size_t l = 0; l < ret_constr.datalen; l++) {
5924 int64_t ret_conv_63 = ret_vals[l];
5925 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5926 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
5927 ret_constr.data[l] = ret_conv_63_conv;
5929 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5932 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5933 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5935 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5936 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5937 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5938 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5940 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5941 LDKCVec_NodeAnnouncementZ ret_constr;
5942 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5943 if (ret_constr.datalen > 0)
5944 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5946 ret_constr.data = NULL;
5947 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5948 for (size_t s = 0; s < ret_constr.datalen; s++) {
5949 int64_t ret_conv_18 = ret_vals[s];
5950 LDKNodeAnnouncement ret_conv_18_conv;
5951 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5952 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5953 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5954 ret_constr.data[s] = ret_conv_18_conv;
5956 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5959 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5960 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5962 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5963 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5964 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5965 LDKInit init_var = *init;
5966 init_var = Init_clone(init);
5967 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5968 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5969 long init_ref = (long)init_var.inner;
5970 if (init_var.is_owned) {
5973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5975 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5977 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5978 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5980 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5981 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5982 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5983 LDKReplyChannelRange msg_var = msg;
5984 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5985 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5986 long msg_ref = (long)msg_var.inner;
5987 if (msg_var.is_owned) {
5990 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5992 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5993 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5994 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5997 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5998 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6000 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6001 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6002 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6003 LDKReplyShortChannelIdsEnd msg_var = msg;
6004 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6005 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6006 long msg_ref = (long)msg_var.inner;
6007 if (msg_var.is_owned) {
6010 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6012 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6013 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6014 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6017 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6018 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6020 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6021 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6022 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6023 LDKQueryChannelRange msg_var = msg;
6024 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6025 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6026 long msg_ref = (long)msg_var.inner;
6027 if (msg_var.is_owned) {
6030 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6032 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6033 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6034 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6037 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6038 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6040 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6041 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6042 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6043 LDKQueryShortChannelIds msg_var = msg;
6044 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6045 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6046 long msg_ref = (long)msg_var.inner;
6047 if (msg_var.is_owned) {
6050 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6052 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6053 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6054 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6057 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
6058 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6059 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6060 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6061 return (void*) this_arg;
6063 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6064 jclass c = (*env)->GetObjectClass(env, o);
6066 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6067 atomic_init(&calls->refcnt, 1);
6068 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6069 calls->o = (*env)->NewWeakGlobalRef(env, o);
6070 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
6071 CHECK(calls->handle_node_announcement_meth != NULL);
6072 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
6073 CHECK(calls->handle_channel_announcement_meth != NULL);
6074 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
6075 CHECK(calls->handle_channel_update_meth != NULL);
6076 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
6077 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
6078 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
6079 CHECK(calls->get_next_channel_announcements_meth != NULL);
6080 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
6081 CHECK(calls->get_next_node_announcements_meth != NULL);
6082 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
6083 CHECK(calls->sync_routing_table_meth != NULL);
6084 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
6085 CHECK(calls->handle_reply_channel_range_meth != NULL);
6086 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
6087 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
6088 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
6089 CHECK(calls->handle_query_channel_range_meth != NULL);
6090 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
6091 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
6093 LDKRoutingMessageHandler ret = {
6094 .this_arg = (void*) calls,
6095 .handle_node_announcement = handle_node_announcement_jcall,
6096 .handle_channel_announcement = handle_channel_announcement_jcall,
6097 .handle_channel_update = handle_channel_update_jcall,
6098 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
6099 .get_next_channel_announcements = get_next_channel_announcements_jcall,
6100 .get_next_node_announcements = get_next_node_announcements_jcall,
6101 .sync_routing_table = sync_routing_table_jcall,
6102 .handle_reply_channel_range = handle_reply_channel_range_jcall,
6103 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
6104 .handle_query_channel_range = handle_query_channel_range_jcall,
6105 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
6106 .free = LDKRoutingMessageHandler_JCalls_free,
6107 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
6109 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6113 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6114 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
6115 return (long)res_ptr;
6117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6118 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6119 LDKNodeAnnouncement msg_conv;
6120 msg_conv.inner = (void*)(msg & (~1));
6121 msg_conv.is_owned = false;
6122 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6123 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6124 return (long)ret_conv;
6127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6128 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6129 LDKChannelAnnouncement msg_conv;
6130 msg_conv.inner = (void*)(msg & (~1));
6131 msg_conv.is_owned = false;
6132 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6133 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6134 return (long)ret_conv;
6137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6138 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6139 LDKChannelUpdate msg_conv;
6140 msg_conv.inner = (void*)(msg & (~1));
6141 msg_conv.is_owned = false;
6142 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6143 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6144 return (long)ret_conv;
6147 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) {
6148 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6149 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6150 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6153 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) {
6154 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6155 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6156 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6157 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6158 for (size_t l = 0; l < ret_var.datalen; l++) {
6159 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6160 *ret_conv_63_ref = ret_var.data[l];
6161 ret_arr_ptr[l] = (long)ret_conv_63_ref;
6163 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6168 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) {
6169 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6170 LDKPublicKey starting_point_ref;
6171 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
6172 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
6173 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6174 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6175 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6176 for (size_t s = 0; s < ret_var.datalen; s++) {
6177 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6178 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6179 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6180 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
6181 if (ret_conv_18_var.is_owned) {
6182 ret_conv_18_ref |= 1;
6184 ret_arr_ptr[s] = ret_conv_18_ref;
6186 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6191 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) {
6192 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6193 LDKPublicKey their_node_id_ref;
6194 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6195 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6197 init_conv.inner = (void*)(init & (~1));
6198 init_conv.is_owned = false;
6199 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6202 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) {
6203 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6204 LDKPublicKey their_node_id_ref;
6205 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6206 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6207 LDKReplyChannelRange msg_conv;
6208 msg_conv.inner = (void*)(msg & (~1));
6209 msg_conv.is_owned = (msg & 1) || (msg == 0);
6210 msg_conv = ReplyChannelRange_clone(&msg_conv);
6211 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6212 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6213 return (long)ret_conv;
6216 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) {
6217 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6218 LDKPublicKey their_node_id_ref;
6219 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6220 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6221 LDKReplyShortChannelIdsEnd msg_conv;
6222 msg_conv.inner = (void*)(msg & (~1));
6223 msg_conv.is_owned = (msg & 1) || (msg == 0);
6224 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6225 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6226 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6227 return (long)ret_conv;
6230 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) {
6231 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6232 LDKPublicKey their_node_id_ref;
6233 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6234 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6235 LDKQueryChannelRange msg_conv;
6236 msg_conv.inner = (void*)(msg & (~1));
6237 msg_conv.is_owned = (msg & 1) || (msg == 0);
6238 msg_conv = QueryChannelRange_clone(&msg_conv);
6239 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6240 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6241 return (long)ret_conv;
6244 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) {
6245 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6246 LDKPublicKey their_node_id_ref;
6247 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6248 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6249 LDKQueryShortChannelIds msg_conv;
6250 msg_conv.inner = (void*)(msg & (~1));
6251 msg_conv.is_owned = (msg & 1) || (msg == 0);
6252 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6253 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6254 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6255 return (long)ret_conv;
6258 typedef struct LDKSocketDescriptor_JCalls {
6259 atomic_size_t refcnt;
6262 jmethodID send_data_meth;
6263 jmethodID disconnect_socket_meth;
6265 jmethodID hash_meth;
6266 } LDKSocketDescriptor_JCalls;
6267 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6268 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6269 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6271 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6272 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6276 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6277 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6279 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6280 LDKu8slice data_var = data;
6281 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
6282 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
6283 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6285 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
6287 void disconnect_socket_jcall(void* this_arg) {
6288 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6290 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6291 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6293 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
6295 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6296 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6299 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6300 *other_arg_clone = SocketDescriptor_clone(other_arg);
6301 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6303 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
6305 uint64_t hash_jcall(const void* this_arg) {
6306 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6308 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6309 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6311 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
6313 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
6314 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6315 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6316 return (void*) this_arg;
6318 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
6319 jclass c = (*env)->GetObjectClass(env, o);
6321 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6322 atomic_init(&calls->refcnt, 1);
6323 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6324 calls->o = (*env)->NewWeakGlobalRef(env, o);
6325 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
6326 CHECK(calls->send_data_meth != NULL);
6327 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
6328 CHECK(calls->disconnect_socket_meth != NULL);
6329 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
6330 CHECK(calls->eq_meth != NULL);
6331 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
6332 CHECK(calls->hash_meth != NULL);
6334 LDKSocketDescriptor ret = {
6335 .this_arg = (void*) calls,
6336 .send_data = send_data_jcall,
6337 .disconnect_socket = disconnect_socket_jcall,
6340 .clone = LDKSocketDescriptor_JCalls_clone,
6341 .free = LDKSocketDescriptor_JCalls_free,
6345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
6346 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6347 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
6348 return (long)res_ptr;
6350 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) {
6351 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6352 LDKu8slice data_ref;
6353 data_ref.datalen = (*env)->GetArrayLength(env, data);
6354 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
6355 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6356 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
6360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
6361 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6362 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
6366 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6367 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6372 LDKTransaction _res_ref;
6373 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6374 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6375 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6376 _res_ref.data_is_owned = true;
6377 Transaction_free(_res_ref);
6380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
6381 if ((_res & 1) != 0) return;
6382 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6384 TxOut_free(_res_conv);
6387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6388 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6389 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6390 *ret_ref = TxOut_clone(orig_conv);
6391 return (long)ret_ref;
6394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6396 CHECK((*env)->GetArrayLength(env, o) == 32);
6397 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6398 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6399 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6400 return (long)ret_conv;
6403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6404 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6405 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6406 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6407 return (long)ret_conv;
6410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6411 if ((_res & 1) != 0) return;
6412 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6414 CResult_SecretKeyErrorZ_free(_res_conv);
6417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6419 CHECK((*env)->GetArrayLength(env, o) == 33);
6420 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6421 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6422 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6423 return (long)ret_conv;
6426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6427 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6428 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6429 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6430 return (long)ret_conv;
6433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6434 if ((_res & 1) != 0) return;
6435 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6437 CResult_PublicKeyErrorZ_free(_res_conv);
6440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6441 LDKTxCreationKeys o_conv;
6442 o_conv.inner = (void*)(o & (~1));
6443 o_conv.is_owned = (o & 1) || (o == 0);
6444 o_conv = TxCreationKeys_clone(&o_conv);
6445 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6446 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6447 return (long)ret_conv;
6450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6451 LDKDecodeError e_conv;
6452 e_conv.inner = (void*)(e & (~1));
6453 e_conv.is_owned = (e & 1) || (e == 0);
6454 e_conv = DecodeError_clone(&e_conv);
6455 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6456 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6457 return (long)ret_conv;
6460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6461 if ((_res & 1) != 0) return;
6462 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6464 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6468 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6469 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6470 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6471 return (long)ret_conv;
6474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6475 LDKChannelPublicKeys o_conv;
6476 o_conv.inner = (void*)(o & (~1));
6477 o_conv.is_owned = (o & 1) || (o == 0);
6478 o_conv = ChannelPublicKeys_clone(&o_conv);
6479 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6480 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6481 return (long)ret_conv;
6484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6485 LDKDecodeError e_conv;
6486 e_conv.inner = (void*)(e & (~1));
6487 e_conv.is_owned = (e & 1) || (e == 0);
6488 e_conv = DecodeError_clone(&e_conv);
6489 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6490 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6491 return (long)ret_conv;
6494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6495 if ((_res & 1) != 0) return;
6496 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6498 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6502 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6503 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6504 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6505 return (long)ret_conv;
6508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6509 LDKTxCreationKeys o_conv;
6510 o_conv.inner = (void*)(o & (~1));
6511 o_conv.is_owned = (o & 1) || (o == 0);
6512 o_conv = TxCreationKeys_clone(&o_conv);
6513 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6514 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6515 return (long)ret_conv;
6518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6519 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6520 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6521 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6522 return (long)ret_conv;
6525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6526 if ((_res & 1) != 0) return;
6527 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6529 CResult_TxCreationKeysErrorZ_free(_res_conv);
6532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6533 LDKHTLCOutputInCommitment o_conv;
6534 o_conv.inner = (void*)(o & (~1));
6535 o_conv.is_owned = (o & 1) || (o == 0);
6536 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6537 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6538 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6539 return (long)ret_conv;
6542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6543 LDKDecodeError e_conv;
6544 e_conv.inner = (void*)(e & (~1));
6545 e_conv.is_owned = (e & 1) || (e == 0);
6546 e_conv = DecodeError_clone(&e_conv);
6547 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6548 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6549 return (long)ret_conv;
6552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6553 if ((_res & 1) != 0) return;
6554 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6556 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6560 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6561 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6562 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6563 return (long)ret_conv;
6566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6567 LDKCounterpartyChannelTransactionParameters o_conv;
6568 o_conv.inner = (void*)(o & (~1));
6569 o_conv.is_owned = (o & 1) || (o == 0);
6570 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6571 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6572 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6573 return (long)ret_conv;
6576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6577 LDKDecodeError e_conv;
6578 e_conv.inner = (void*)(e & (~1));
6579 e_conv.is_owned = (e & 1) || (e == 0);
6580 e_conv = DecodeError_clone(&e_conv);
6581 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6582 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6583 return (long)ret_conv;
6586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6587 if ((_res & 1) != 0) return;
6588 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6590 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6594 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6595 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6596 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6597 return (long)ret_conv;
6600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6601 LDKChannelTransactionParameters o_conv;
6602 o_conv.inner = (void*)(o & (~1));
6603 o_conv.is_owned = (o & 1) || (o == 0);
6604 o_conv = ChannelTransactionParameters_clone(&o_conv);
6605 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6606 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6607 return (long)ret_conv;
6610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6611 LDKDecodeError e_conv;
6612 e_conv.inner = (void*)(e & (~1));
6613 e_conv.is_owned = (e & 1) || (e == 0);
6614 e_conv = DecodeError_clone(&e_conv);
6615 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6616 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6617 return (long)ret_conv;
6620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6621 if ((_res & 1) != 0) return;
6622 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6624 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6628 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6629 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6630 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6631 return (long)ret_conv;
6634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6635 LDKCVec_SignatureZ _res_constr;
6636 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6637 if (_res_constr.datalen > 0)
6638 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6640 _res_constr.data = NULL;
6641 for (size_t i = 0; i < _res_constr.datalen; i++) {
6642 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6643 LDKSignature _res_conv_8_ref;
6644 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
6645 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
6646 _res_constr.data[i] = _res_conv_8_ref;
6648 CVec_SignatureZ_free(_res_constr);
6651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6652 LDKHolderCommitmentTransaction o_conv;
6653 o_conv.inner = (void*)(o & (~1));
6654 o_conv.is_owned = (o & 1) || (o == 0);
6655 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6656 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6657 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6658 return (long)ret_conv;
6661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6662 LDKDecodeError e_conv;
6663 e_conv.inner = (void*)(e & (~1));
6664 e_conv.is_owned = (e & 1) || (e == 0);
6665 e_conv = DecodeError_clone(&e_conv);
6666 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6667 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6668 return (long)ret_conv;
6671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6672 if ((_res & 1) != 0) return;
6673 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6675 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6679 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6680 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6681 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6682 return (long)ret_conv;
6685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6686 LDKBuiltCommitmentTransaction o_conv;
6687 o_conv.inner = (void*)(o & (~1));
6688 o_conv.is_owned = (o & 1) || (o == 0);
6689 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6690 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6691 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6692 return (long)ret_conv;
6695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6696 LDKDecodeError e_conv;
6697 e_conv.inner = (void*)(e & (~1));
6698 e_conv.is_owned = (e & 1) || (e == 0);
6699 e_conv = DecodeError_clone(&e_conv);
6700 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6701 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6702 return (long)ret_conv;
6705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6706 if ((_res & 1) != 0) return;
6707 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6709 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6713 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6714 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6715 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6716 return (long)ret_conv;
6719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6720 LDKCommitmentTransaction o_conv;
6721 o_conv.inner = (void*)(o & (~1));
6722 o_conv.is_owned = (o & 1) || (o == 0);
6723 o_conv = CommitmentTransaction_clone(&o_conv);
6724 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6725 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6726 return (long)ret_conv;
6729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6730 LDKDecodeError e_conv;
6731 e_conv.inner = (void*)(e & (~1));
6732 e_conv.is_owned = (e & 1) || (e == 0);
6733 e_conv = DecodeError_clone(&e_conv);
6734 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6735 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6736 return (long)ret_conv;
6739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6740 if ((_res & 1) != 0) return;
6741 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6743 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6747 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6748 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6749 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6750 return (long)ret_conv;
6753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6754 LDKTrustedCommitmentTransaction o_conv;
6755 o_conv.inner = (void*)(o & (~1));
6756 o_conv.is_owned = (o & 1) || (o == 0);
6757 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6758 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6759 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6760 return (long)ret_conv;
6763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6764 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6765 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6766 return (long)ret_conv;
6769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6770 if ((_res & 1) != 0) return;
6771 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6773 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6777 LDKCVec_SignatureZ o_constr;
6778 o_constr.datalen = (*env)->GetArrayLength(env, o);
6779 if (o_constr.datalen > 0)
6780 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6782 o_constr.data = NULL;
6783 for (size_t i = 0; i < o_constr.datalen; i++) {
6784 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6785 LDKSignature o_conv_8_ref;
6786 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
6787 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
6788 o_constr.data[i] = o_conv_8_ref;
6790 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6791 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6792 return (long)ret_conv;
6795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6796 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6797 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6798 return (long)ret_conv;
6801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6802 if ((_res & 1) != 0) return;
6803 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6805 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6809 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6810 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6811 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6812 return (long)ret_conv;
6815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6816 LDKCVec_MessageSendEventZ _res_constr;
6817 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6818 if (_res_constr.datalen > 0)
6819 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6821 _res_constr.data = NULL;
6822 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6823 for (size_t s = 0; s < _res_constr.datalen; s++) {
6824 int64_t _res_conv_18 = _res_vals[s];
6825 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6826 FREE((void*)_res_conv_18);
6827 _res_constr.data[s] = _res_conv_18_conv;
6829 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6830 CVec_MessageSendEventZ_free(_res_constr);
6833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6834 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6835 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6836 return (long)ret_conv;
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6840 LDKLightningError e_conv;
6841 e_conv.inner = (void*)(e & (~1));
6842 e_conv.is_owned = (e & 1) || (e == 0);
6843 e_conv = LightningError_clone(&e_conv);
6844 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6845 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6846 return (long)ret_conv;
6849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6850 if ((_res & 1) != 0) return;
6851 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6853 CResult_boolLightningErrorZ_free(_res_conv);
6856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6857 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6858 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6859 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6860 return (long)ret_conv;
6863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6864 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6865 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6866 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6867 return (long)ret_ref;
6870 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) {
6871 LDKChannelAnnouncement a_conv;
6872 a_conv.inner = (void*)(a & (~1));
6873 a_conv.is_owned = (a & 1) || (a == 0);
6874 a_conv = ChannelAnnouncement_clone(&a_conv);
6875 LDKChannelUpdate b_conv;
6876 b_conv.inner = (void*)(b & (~1));
6877 b_conv.is_owned = (b & 1) || (b == 0);
6878 b_conv = ChannelUpdate_clone(&b_conv);
6879 LDKChannelUpdate c_conv;
6880 c_conv.inner = (void*)(c & (~1));
6881 c_conv.is_owned = (c & 1) || (c == 0);
6882 c_conv = ChannelUpdate_clone(&c_conv);
6883 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6884 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6885 return (long)ret_ref;
6888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6889 if ((_res & 1) != 0) return;
6890 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6892 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6896 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6897 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6898 if (_res_constr.datalen > 0)
6899 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6901 _res_constr.data = NULL;
6902 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6903 for (size_t l = 0; l < _res_constr.datalen; l++) {
6904 int64_t _res_conv_63 = _res_vals[l];
6905 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6906 FREE((void*)_res_conv_63);
6907 _res_constr.data[l] = _res_conv_63_conv;
6909 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6910 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6914 LDKCVec_NodeAnnouncementZ _res_constr;
6915 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6916 if (_res_constr.datalen > 0)
6917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6919 _res_constr.data = NULL;
6920 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6921 for (size_t s = 0; s < _res_constr.datalen; s++) {
6922 int64_t _res_conv_18 = _res_vals[s];
6923 LDKNodeAnnouncement _res_conv_18_conv;
6924 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6925 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6926 _res_constr.data[s] = _res_conv_18_conv;
6928 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6929 CVec_NodeAnnouncementZ_free(_res_constr);
6932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6933 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6934 *ret_conv = CResult_NoneLightningErrorZ_ok();
6935 return (long)ret_conv;
6938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6939 LDKLightningError e_conv;
6940 e_conv.inner = (void*)(e & (~1));
6941 e_conv.is_owned = (e & 1) || (e == 0);
6942 e_conv = LightningError_clone(&e_conv);
6943 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6944 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6945 return (long)ret_conv;
6948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6949 if ((_res & 1) != 0) return;
6950 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6952 CResult_NoneLightningErrorZ_free(_res_conv);
6955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6956 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6957 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6958 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6959 return (long)ret_conv;
6962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6963 LDKCVec_PublicKeyZ _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(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6968 _res_constr.data = NULL;
6969 for (size_t i = 0; i < _res_constr.datalen; i++) {
6970 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6971 LDKPublicKey _res_conv_8_ref;
6972 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
6973 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
6974 _res_constr.data[i] = _res_conv_8_ref;
6976 CVec_PublicKeyZ_free(_res_constr);
6979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6980 LDKCVec_u8Z _res_ref;
6981 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6982 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6983 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6984 CVec_u8Z_free(_res_ref);
6987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6989 o_ref.datalen = (*env)->GetArrayLength(env, o);
6990 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6991 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6992 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6993 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6994 return (long)ret_conv;
6997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6998 LDKPeerHandleError e_conv;
6999 e_conv.inner = (void*)(e & (~1));
7000 e_conv.is_owned = (e & 1) || (e == 0);
7001 e_conv = PeerHandleError_clone(&e_conv);
7002 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7003 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
7004 return (long)ret_conv;
7007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7008 if ((_res & 1) != 0) return;
7009 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7011 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
7014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7015 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
7016 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7017 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
7018 return (long)ret_conv;
7021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
7022 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7023 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
7024 return (long)ret_conv;
7027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7028 LDKPeerHandleError e_conv;
7029 e_conv.inner = (void*)(e & (~1));
7030 e_conv.is_owned = (e & 1) || (e == 0);
7031 e_conv = PeerHandleError_clone(&e_conv);
7032 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7033 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
7034 return (long)ret_conv;
7037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7038 if ((_res & 1) != 0) return;
7039 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7041 CResult_NonePeerHandleErrorZ_free(_res_conv);
7044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7045 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
7046 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7047 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
7048 return (long)ret_conv;
7051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
7052 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7053 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
7054 return (long)ret_conv;
7057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7058 LDKPeerHandleError e_conv;
7059 e_conv.inner = (void*)(e & (~1));
7060 e_conv.is_owned = (e & 1) || (e == 0);
7061 e_conv = PeerHandleError_clone(&e_conv);
7062 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7063 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
7064 return (long)ret_conv;
7067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7068 if ((_res & 1) != 0) return;
7069 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7071 CResult_boolPeerHandleErrorZ_free(_res_conv);
7074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7075 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
7076 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7077 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
7078 return (long)ret_conv;
7081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7082 LDKInitFeatures o_conv;
7083 o_conv.inner = (void*)(o & (~1));
7084 o_conv.is_owned = (o & 1) || (o == 0);
7085 o_conv = InitFeatures_clone(&o_conv);
7086 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7087 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7088 return (long)ret_conv;
7091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7092 LDKDecodeError e_conv;
7093 e_conv.inner = (void*)(e & (~1));
7094 e_conv.is_owned = (e & 1) || (e == 0);
7095 e_conv = DecodeError_clone(&e_conv);
7096 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7097 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7098 return (long)ret_conv;
7101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7102 if ((_res & 1) != 0) return;
7103 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7105 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7109 LDKNodeFeatures o_conv;
7110 o_conv.inner = (void*)(o & (~1));
7111 o_conv.is_owned = (o & 1) || (o == 0);
7112 o_conv = NodeFeatures_clone(&o_conv);
7113 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7114 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7115 return (long)ret_conv;
7118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7119 LDKDecodeError e_conv;
7120 e_conv.inner = (void*)(e & (~1));
7121 e_conv.is_owned = (e & 1) || (e == 0);
7122 e_conv = DecodeError_clone(&e_conv);
7123 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7124 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7125 return (long)ret_conv;
7128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7129 if ((_res & 1) != 0) return;
7130 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7132 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7136 LDKChannelFeatures o_conv;
7137 o_conv.inner = (void*)(o & (~1));
7138 o_conv.is_owned = (o & 1) || (o == 0);
7139 o_conv = ChannelFeatures_clone(&o_conv);
7140 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7141 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7142 return (long)ret_conv;
7145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7146 LDKDecodeError e_conv;
7147 e_conv.inner = (void*)(e & (~1));
7148 e_conv.is_owned = (e & 1) || (e == 0);
7149 e_conv = DecodeError_clone(&e_conv);
7150 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7151 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7152 return (long)ret_conv;
7155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7156 if ((_res & 1) != 0) return;
7157 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7159 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7163 LDKInvoiceFeatures o_conv;
7164 o_conv.inner = (void*)(o & (~1));
7165 o_conv.is_owned = (o & 1) || (o == 0);
7166 o_conv = InvoiceFeatures_clone(&o_conv);
7167 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7168 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7169 return (long)ret_conv;
7172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7173 LDKDecodeError e_conv;
7174 e_conv.inner = (void*)(e & (~1));
7175 e_conv.is_owned = (e & 1) || (e == 0);
7176 e_conv = DecodeError_clone(&e_conv);
7177 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7178 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7179 return (long)ret_conv;
7182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7183 if ((_res & 1) != 0) return;
7184 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7186 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7190 LDKChannelConfig o_conv;
7191 o_conv.inner = (void*)(o & (~1));
7192 o_conv.is_owned = (o & 1) || (o == 0);
7193 o_conv = ChannelConfig_clone(&o_conv);
7194 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7195 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
7196 return (long)ret_conv;
7199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7200 LDKDecodeError e_conv;
7201 e_conv.inner = (void*)(e & (~1));
7202 e_conv.is_owned = (e & 1) || (e == 0);
7203 e_conv = DecodeError_clone(&e_conv);
7204 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7205 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
7206 return (long)ret_conv;
7209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7210 if ((_res & 1) != 0) return;
7211 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
7213 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
7216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7217 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
7218 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7219 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
7220 return (long)ret_conv;
7223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7224 LDKDirectionalChannelInfo o_conv;
7225 o_conv.inner = (void*)(o & (~1));
7226 o_conv.is_owned = (o & 1) || (o == 0);
7227 o_conv = DirectionalChannelInfo_clone(&o_conv);
7228 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7229 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7230 return (long)ret_conv;
7233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7234 LDKDecodeError e_conv;
7235 e_conv.inner = (void*)(e & (~1));
7236 e_conv.is_owned = (e & 1) || (e == 0);
7237 e_conv = DecodeError_clone(&e_conv);
7238 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7239 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7240 return (long)ret_conv;
7243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7244 if ((_res & 1) != 0) return;
7245 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7247 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7251 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7252 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7253 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7254 return (long)ret_conv;
7257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7258 LDKChannelInfo o_conv;
7259 o_conv.inner = (void*)(o & (~1));
7260 o_conv.is_owned = (o & 1) || (o == 0);
7261 o_conv = ChannelInfo_clone(&o_conv);
7262 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7263 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7264 return (long)ret_conv;
7267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7268 LDKDecodeError e_conv;
7269 e_conv.inner = (void*)(e & (~1));
7270 e_conv.is_owned = (e & 1) || (e == 0);
7271 e_conv = DecodeError_clone(&e_conv);
7272 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7273 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7274 return (long)ret_conv;
7277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7278 if ((_res & 1) != 0) return;
7279 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7281 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7285 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7286 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7287 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7288 return (long)ret_conv;
7291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7292 LDKRoutingFees o_conv;
7293 o_conv.inner = (void*)(o & (~1));
7294 o_conv.is_owned = (o & 1) || (o == 0);
7295 o_conv = RoutingFees_clone(&o_conv);
7296 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7297 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7298 return (long)ret_conv;
7301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7302 LDKDecodeError e_conv;
7303 e_conv.inner = (void*)(e & (~1));
7304 e_conv.is_owned = (e & 1) || (e == 0);
7305 e_conv = DecodeError_clone(&e_conv);
7306 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7307 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7308 return (long)ret_conv;
7311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7312 if ((_res & 1) != 0) return;
7313 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7315 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7319 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7320 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7321 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7322 return (long)ret_conv;
7325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7326 LDKCVec_NetAddressZ _res_constr;
7327 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7328 if (_res_constr.datalen > 0)
7329 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7331 _res_constr.data = NULL;
7332 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7333 for (size_t m = 0; m < _res_constr.datalen; m++) {
7334 int64_t _res_conv_12 = _res_vals[m];
7335 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7336 FREE((void*)_res_conv_12);
7337 _res_constr.data[m] = _res_conv_12_conv;
7339 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7340 CVec_NetAddressZ_free(_res_constr);
7343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7344 LDKNodeAnnouncementInfo o_conv;
7345 o_conv.inner = (void*)(o & (~1));
7346 o_conv.is_owned = (o & 1) || (o == 0);
7347 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7348 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7349 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7350 return (long)ret_conv;
7353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7354 LDKDecodeError e_conv;
7355 e_conv.inner = (void*)(e & (~1));
7356 e_conv.is_owned = (e & 1) || (e == 0);
7357 e_conv = DecodeError_clone(&e_conv);
7358 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7359 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7360 return (long)ret_conv;
7363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7364 if ((_res & 1) != 0) return;
7365 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7367 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7371 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7372 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7373 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7374 return (long)ret_conv;
7377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7378 LDKCVec_u64Z _res_constr;
7379 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7380 if (_res_constr.datalen > 0)
7381 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7383 _res_constr.data = NULL;
7384 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7385 for (size_t g = 0; g < _res_constr.datalen; g++) {
7386 int64_t _res_conv_6 = _res_vals[g];
7387 _res_constr.data[g] = _res_conv_6;
7389 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7390 CVec_u64Z_free(_res_constr);
7393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7395 o_conv.inner = (void*)(o & (~1));
7396 o_conv.is_owned = (o & 1) || (o == 0);
7397 o_conv = NodeInfo_clone(&o_conv);
7398 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7399 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7400 return (long)ret_conv;
7403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7404 LDKDecodeError e_conv;
7405 e_conv.inner = (void*)(e & (~1));
7406 e_conv.is_owned = (e & 1) || (e == 0);
7407 e_conv = DecodeError_clone(&e_conv);
7408 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7409 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7410 return (long)ret_conv;
7413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7414 if ((_res & 1) != 0) return;
7415 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7417 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7421 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7422 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7423 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7424 return (long)ret_conv;
7427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7428 LDKNetworkGraph o_conv;
7429 o_conv.inner = (void*)(o & (~1));
7430 o_conv.is_owned = (o & 1) || (o == 0);
7431 o_conv = NetworkGraph_clone(&o_conv);
7432 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7433 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7434 return (long)ret_conv;
7437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7438 LDKDecodeError e_conv;
7439 e_conv.inner = (void*)(e & (~1));
7440 e_conv.is_owned = (e & 1) || (e == 0);
7441 e_conv = DecodeError_clone(&e_conv);
7442 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7443 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7444 return (long)ret_conv;
7447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7448 if ((_res & 1) != 0) return;
7449 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7451 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7455 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7456 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7457 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7458 return (long)ret_conv;
7461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7462 LDKTransaction b_ref;
7463 b_ref.datalen = (*env)->GetArrayLength(env, b);
7464 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7465 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7466 b_ref.data_is_owned = true;
7467 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7468 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7469 return (long)ret_ref;
7472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7473 if ((_res & 1) != 0) return;
7474 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7476 C2Tuple_usizeTransactionZ_free(_res_conv);
7479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7480 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7481 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7482 if (_res_constr.datalen > 0)
7483 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7485 _res_constr.data = NULL;
7486 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7487 for (size_t y = 0; y < _res_constr.datalen; y++) {
7488 int64_t _res_conv_24 = _res_vals[y];
7489 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
7490 FREE((void*)_res_conv_24);
7491 _res_constr.data[y] = _res_conv_24_conv;
7493 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7494 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
7498 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7499 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7500 return (long)ret_conv;
7503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
7504 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
7505 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7506 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7507 return (long)ret_conv;
7510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7511 if ((_res & 1) != 0) return;
7512 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7514 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7518 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7519 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7520 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7521 return (long)ret_conv;
7524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7525 LDKCVec_MonitorEventZ _res_constr;
7526 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7527 if (_res_constr.datalen > 0)
7528 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7530 _res_constr.data = NULL;
7531 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7532 for (size_t o = 0; o < _res_constr.datalen; o++) {
7533 int64_t _res_conv_14 = _res_vals[o];
7534 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7535 FREE((void*)_res_conv_14);
7536 _res_constr.data[o] = _res_conv_14_conv;
7538 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7539 CVec_MonitorEventZ_free(_res_constr);
7542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7543 LDKCVec_EventZ _res_constr;
7544 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7545 if (_res_constr.datalen > 0)
7546 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
7548 _res_constr.data = NULL;
7549 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7550 for (size_t h = 0; h < _res_constr.datalen; h++) {
7551 int64_t _res_conv_7 = _res_vals[h];
7552 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
7553 FREE((void*)_res_conv_7);
7554 _res_constr.data[h] = _res_conv_7_conv;
7556 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7557 CVec_EventZ_free(_res_constr);
7560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7562 o_conv.inner = (void*)(o & (~1));
7563 o_conv.is_owned = (o & 1) || (o == 0);
7564 o_conv = OutPoint_clone(&o_conv);
7565 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7566 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
7567 return (long)ret_conv;
7570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7571 LDKDecodeError e_conv;
7572 e_conv.inner = (void*)(e & (~1));
7573 e_conv.is_owned = (e & 1) || (e == 0);
7574 e_conv = DecodeError_clone(&e_conv);
7575 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7576 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
7577 return (long)ret_conv;
7580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7581 if ((_res & 1) != 0) return;
7582 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
7584 CResult_OutPointDecodeErrorZ_free(_res_conv);
7587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7588 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
7589 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7590 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
7591 return (long)ret_conv;
7594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7595 LDKChannelMonitorUpdate o_conv;
7596 o_conv.inner = (void*)(o & (~1));
7597 o_conv.is_owned = (o & 1) || (o == 0);
7598 o_conv = ChannelMonitorUpdate_clone(&o_conv);
7599 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7600 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
7601 return (long)ret_conv;
7604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7605 LDKDecodeError e_conv;
7606 e_conv.inner = (void*)(e & (~1));
7607 e_conv.is_owned = (e & 1) || (e == 0);
7608 e_conv = DecodeError_clone(&e_conv);
7609 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7610 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
7611 return (long)ret_conv;
7614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7615 if ((_res & 1) != 0) return;
7616 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7618 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
7621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7622 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
7623 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7624 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
7625 return (long)ret_conv;
7628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7629 LDKHTLCUpdate o_conv;
7630 o_conv.inner = (void*)(o & (~1));
7631 o_conv.is_owned = (o & 1) || (o == 0);
7632 o_conv = HTLCUpdate_clone(&o_conv);
7633 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7634 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
7635 return (long)ret_conv;
7638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7639 LDKDecodeError e_conv;
7640 e_conv.inner = (void*)(e & (~1));
7641 e_conv.is_owned = (e & 1) || (e == 0);
7642 e_conv = DecodeError_clone(&e_conv);
7643 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7644 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
7645 return (long)ret_conv;
7648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7649 if ((_res & 1) != 0) return;
7650 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7652 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
7655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7656 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
7657 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7658 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
7659 return (long)ret_conv;
7662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
7663 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7664 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
7665 return (long)ret_conv;
7668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7669 LDKMonitorUpdateError e_conv;
7670 e_conv.inner = (void*)(e & (~1));
7671 e_conv.is_owned = (e & 1) || (e == 0);
7672 e_conv = MonitorUpdateError_clone(&e_conv);
7673 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7674 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
7675 return (long)ret_conv;
7678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7679 if ((_res & 1) != 0) return;
7680 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
7682 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
7685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7686 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
7687 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7688 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
7689 return (long)ret_conv;
7692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7693 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
7694 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7695 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
7696 return (long)ret_ref;
7699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7701 a_conv.inner = (void*)(a & (~1));
7702 a_conv.is_owned = (a & 1) || (a == 0);
7703 a_conv = OutPoint_clone(&a_conv);
7705 b_ref.datalen = (*env)->GetArrayLength(env, b);
7706 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7707 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7708 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7709 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
7710 return (long)ret_ref;
7713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7714 if ((_res & 1) != 0) return;
7715 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
7717 C2Tuple_OutPointScriptZ_free(_res_conv);
7720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7721 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
7722 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7723 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
7724 return (long)ret_ref;
7727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
7729 b_ref.datalen = (*env)->GetArrayLength(env, b);
7730 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7731 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7732 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7733 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
7734 return (long)ret_ref;
7737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7738 if ((_res & 1) != 0) return;
7739 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
7741 C2Tuple_u32ScriptZ_free(_res_conv);
7744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7745 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
7746 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7747 if (_res_constr.datalen > 0)
7748 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
7750 _res_constr.data = NULL;
7751 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7752 for (size_t b = 0; b < _res_constr.datalen; b++) {
7753 int64_t _res_conv_27 = _res_vals[b];
7754 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
7755 FREE((void*)_res_conv_27);
7756 _res_constr.data[b] = _res_conv_27_conv;
7758 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7759 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
7762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7763 LDKThirtyTwoBytes a_ref;
7764 CHECK((*env)->GetArrayLength(env, a) == 32);
7765 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7766 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
7767 b_constr.datalen = (*env)->GetArrayLength(env, b);
7768 if (b_constr.datalen > 0)
7769 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
7771 b_constr.data = NULL;
7772 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7773 for (size_t b = 0; b < b_constr.datalen; b++) {
7774 int64_t b_conv_27 = b_vals[b];
7775 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
7776 FREE((void*)b_conv_27);
7777 b_constr.data[b] = b_conv_27_conv;
7779 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7780 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
7781 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
7782 return (long)ret_ref;
7785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7786 if ((_res & 1) != 0) return;
7787 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
7789 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
7792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7793 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
7794 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7795 if (_res_constr.datalen > 0)
7796 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
7798 _res_constr.data = NULL;
7799 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7800 for (size_t v = 0; v < _res_constr.datalen; v++) {
7801 int64_t _res_conv_47 = _res_vals[v];
7802 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
7803 FREE((void*)_res_conv_47);
7804 _res_constr.data[v] = _res_conv_47_conv;
7806 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7807 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
7810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7811 LDKCVec_TransactionZ _res_constr;
7812 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7813 if (_res_constr.datalen > 0)
7814 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7816 _res_constr.data = NULL;
7817 for (size_t i = 0; i < _res_constr.datalen; i++) {
7818 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7819 LDKTransaction _res_conv_8_ref;
7820 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
7821 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
7822 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
7823 _res_conv_8_ref.data_is_owned = true;
7824 _res_constr.data[i] = _res_conv_8_ref;
7826 CVec_TransactionZ_free(_res_constr);
7829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7830 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
7831 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7832 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
7833 return (long)ret_ref;
7836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
7837 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
7839 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7840 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
7841 return (long)ret_ref;
7844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7845 if ((_res & 1) != 0) return;
7846 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
7848 C2Tuple_u32TxOutZ_free(_res_conv);
7851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7852 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
7853 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7854 if (_res_constr.datalen > 0)
7855 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7857 _res_constr.data = NULL;
7858 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7859 for (size_t a = 0; a < _res_constr.datalen; a++) {
7860 int64_t _res_conv_26 = _res_vals[a];
7861 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
7862 FREE((void*)_res_conv_26);
7863 _res_constr.data[a] = _res_conv_26_conv;
7865 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7866 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
7869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7870 LDKThirtyTwoBytes a_ref;
7871 CHECK((*env)->GetArrayLength(env, a) == 32);
7872 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7873 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
7874 b_constr.datalen = (*env)->GetArrayLength(env, b);
7875 if (b_constr.datalen > 0)
7876 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7878 b_constr.data = NULL;
7879 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7880 for (size_t a = 0; a < b_constr.datalen; a++) {
7881 int64_t b_conv_26 = b_vals[a];
7882 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
7883 FREE((void*)b_conv_26);
7884 b_constr.data[a] = b_conv_26_conv;
7886 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7887 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7888 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
7889 return (long)ret_ref;
7892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7893 if ((_res & 1) != 0) return;
7894 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
7896 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
7899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7900 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
7901 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7902 if (_res_constr.datalen > 0)
7903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
7905 _res_constr.data = NULL;
7906 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7907 for (size_t u = 0; u < _res_constr.datalen; u++) {
7908 int64_t _res_conv_46 = _res_vals[u];
7909 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
7910 FREE((void*)_res_conv_46);
7911 _res_constr.data[u] = _res_conv_46_conv;
7913 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7914 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
7917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7918 LDKThirtyTwoBytes a_ref;
7919 CHECK((*env)->GetArrayLength(env, a) == 32);
7920 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7921 LDKChannelMonitor b_conv;
7922 b_conv.inner = (void*)(b & (~1));
7923 b_conv.is_owned = (b & 1) || (b == 0);
7924 b_conv = ChannelMonitor_clone(&b_conv);
7925 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7926 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7927 return (long)ret_ref;
7930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7931 if ((_res & 1) != 0) return;
7932 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7934 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7938 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
7940 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7941 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
7942 return (long)ret_conv;
7945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7946 LDKDecodeError e_conv;
7947 e_conv.inner = (void*)(e & (~1));
7948 e_conv.is_owned = (e & 1) || (e == 0);
7949 e_conv = DecodeError_clone(&e_conv);
7950 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7951 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
7952 return (long)ret_conv;
7955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7956 if ((_res & 1) != 0) return;
7957 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7959 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
7962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7963 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7964 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7965 if (_res_constr.datalen > 0)
7966 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7968 _res_constr.data = NULL;
7969 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7970 for (size_t b = 0; b < _res_constr.datalen; b++) {
7971 int64_t _res_conv_27 = _res_vals[b];
7972 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7973 FREE((void*)_res_conv_27);
7974 _res_constr.data[b] = _res_conv_27_conv;
7976 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7977 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7981 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7983 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7984 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7985 return (long)ret_conv;
7988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7989 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
7990 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7991 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7992 return (long)ret_conv;
7995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7996 if ((_res & 1) != 0) return;
7997 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7999 CResult_TxOutAccessErrorZ_free(_res_conv);
8002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8003 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8004 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8005 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8006 return (long)ret_conv;
8009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
8010 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8011 *ret_conv = CResult_NoneAPIErrorZ_ok();
8012 return (long)ret_conv;
8015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8016 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8018 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8019 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8020 return (long)ret_conv;
8023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8024 if ((_res & 1) != 0) return;
8025 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8027 CResult_NoneAPIErrorZ_free(_res_conv);
8030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8031 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8032 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8033 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8034 return (long)ret_conv;
8037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8038 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8039 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8040 if (_res_constr.datalen > 0)
8041 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8043 _res_constr.data = NULL;
8044 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8045 for (size_t w = 0; w < _res_constr.datalen; w++) {
8046 int64_t _res_conv_22 = _res_vals[w];
8047 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8048 FREE((void*)_res_conv_22);
8049 _res_constr.data[w] = _res_conv_22_conv;
8051 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8052 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8056 LDKCVec_APIErrorZ _res_constr;
8057 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8058 if (_res_constr.datalen > 0)
8059 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8061 _res_constr.data = NULL;
8062 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8063 for (size_t k = 0; k < _res_constr.datalen; k++) {
8064 int64_t _res_conv_10 = _res_vals[k];
8065 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8066 FREE((void*)_res_conv_10);
8067 _res_constr.data[k] = _res_conv_10_conv;
8069 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8070 CVec_APIErrorZ_free(_res_constr);
8073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8074 LDKCVec_ChannelDetailsZ _res_constr;
8075 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8076 if (_res_constr.datalen > 0)
8077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8079 _res_constr.data = NULL;
8080 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8081 for (size_t q = 0; q < _res_constr.datalen; q++) {
8082 int64_t _res_conv_16 = _res_vals[q];
8083 LDKChannelDetails _res_conv_16_conv;
8084 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8085 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8086 _res_constr.data[q] = _res_conv_16_conv;
8088 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8089 CVec_ChannelDetailsZ_free(_res_constr);
8092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
8093 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8094 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8095 return (long)ret_conv;
8098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8099 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8101 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8102 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8103 return (long)ret_conv;
8106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8107 if ((_res & 1) != 0) return;
8108 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8110 CResult_NonePaymentSendFailureZ_free(_res_conv);
8113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8114 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8115 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8116 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8117 return (long)ret_conv;
8120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8121 LDKCVec_ChannelMonitorZ _res_constr;
8122 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8123 if (_res_constr.datalen > 0)
8124 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8126 _res_constr.data = NULL;
8127 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8128 for (size_t q = 0; q < _res_constr.datalen; q++) {
8129 int64_t _res_conv_16 = _res_vals[q];
8130 LDKChannelMonitor _res_conv_16_conv;
8131 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8132 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8133 _res_constr.data[q] = _res_conv_16_conv;
8135 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8136 CVec_ChannelMonitorZ_free(_res_constr);
8139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
8140 LDKThirtyTwoBytes a_ref;
8141 CHECK((*env)->GetArrayLength(env, a) == 32);
8142 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8143 LDKChannelManager b_conv;
8144 b_conv.inner = (void*)(b & (~1));
8145 b_conv.is_owned = (b & 1) || (b == 0);
8146 // Warning: we need a move here but no clone is available for LDKChannelManager
8147 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8148 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8149 return (long)ret_ref;
8152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8153 if ((_res & 1) != 0) return;
8154 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8156 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8160 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8162 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8163 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8164 return (long)ret_conv;
8167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8168 LDKDecodeError e_conv;
8169 e_conv.inner = (void*)(e & (~1));
8170 e_conv.is_owned = (e & 1) || (e == 0);
8171 e_conv = DecodeError_clone(&e_conv);
8172 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8173 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8174 return (long)ret_conv;
8177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8178 if ((_res & 1) != 0) return;
8179 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8181 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8185 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8187 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8188 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8189 return (long)ret_conv;
8192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8193 LDKDecodeError e_conv;
8194 e_conv.inner = (void*)(e & (~1));
8195 e_conv.is_owned = (e & 1) || (e == 0);
8196 e_conv = DecodeError_clone(&e_conv);
8197 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8198 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8199 return (long)ret_conv;
8202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8203 if ((_res & 1) != 0) return;
8204 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8206 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8210 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8211 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8212 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8213 return (long)ret_conv;
8216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8217 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8218 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8219 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8220 return (long)ret_ref;
8223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
8225 CHECK((*env)->GetArrayLength(env, a) == 64);
8226 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
8227 LDKCVec_SignatureZ b_constr;
8228 b_constr.datalen = (*env)->GetArrayLength(env, b);
8229 if (b_constr.datalen > 0)
8230 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8232 b_constr.data = NULL;
8233 for (size_t i = 0; i < b_constr.datalen; i++) {
8234 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
8235 LDKSignature b_conv_8_ref;
8236 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
8237 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
8238 b_constr.data[i] = b_conv_8_ref;
8240 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8241 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8242 return (long)ret_ref;
8245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8246 if ((_res & 1) != 0) return;
8247 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8249 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8253 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8255 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8256 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8257 return (long)ret_conv;
8260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
8261 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8262 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8263 return (long)ret_conv;
8266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8267 if ((_res & 1) != 0) return;
8268 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8270 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8274 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8275 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8276 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8277 return (long)ret_conv;
8280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8282 CHECK((*env)->GetArrayLength(env, o) == 64);
8283 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
8284 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8285 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8286 return (long)ret_conv;
8289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
8290 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8291 *ret_conv = CResult_SignatureNoneZ_err();
8292 return (long)ret_conv;
8295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8296 if ((_res & 1) != 0) return;
8297 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8299 CResult_SignatureNoneZ_free(_res_conv);
8302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8303 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8304 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8305 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8306 return (long)ret_conv;
8309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8310 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8311 if (o_conv.free == LDKSign_JCalls_free) {
8312 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8313 LDKSign_JCalls_clone(o_conv.this_arg);
8315 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8316 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8317 return (long)ret_conv;
8320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8321 LDKDecodeError e_conv;
8322 e_conv.inner = (void*)(e & (~1));
8323 e_conv.is_owned = (e & 1) || (e == 0);
8324 e_conv = DecodeError_clone(&e_conv);
8325 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8326 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8327 return (long)ret_conv;
8330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8331 if ((_res & 1) != 0) return;
8332 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8334 CResult_SignDecodeErrorZ_free(_res_conv);
8337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8338 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8339 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8340 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8341 return (long)ret_conv;
8344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8345 LDKCVec_CVec_u8ZZ _res_constr;
8346 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8347 if (_res_constr.datalen > 0)
8348 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8350 _res_constr.data = NULL;
8351 for (size_t i = 0; i < _res_constr.datalen; i++) {
8352 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8353 LDKCVec_u8Z _res_conv_8_ref;
8354 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
8355 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8356 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
8357 _res_constr.data[i] = _res_conv_8_ref;
8359 CVec_CVec_u8ZZ_free(_res_constr);
8362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
8363 LDKCVec_CVec_u8ZZ o_constr;
8364 o_constr.datalen = (*env)->GetArrayLength(env, o);
8365 if (o_constr.datalen > 0)
8366 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8368 o_constr.data = NULL;
8369 for (size_t i = 0; i < o_constr.datalen; i++) {
8370 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
8371 LDKCVec_u8Z o_conv_8_ref;
8372 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
8373 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8374 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
8375 o_constr.data[i] = o_conv_8_ref;
8377 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8378 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8379 return (long)ret_conv;
8382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
8383 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8384 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8385 return (long)ret_conv;
8388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8389 if ((_res & 1) != 0) return;
8390 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8392 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8396 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8397 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8398 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8399 return (long)ret_conv;
8402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8403 LDKInMemorySigner o_conv;
8404 o_conv.inner = (void*)(o & (~1));
8405 o_conv.is_owned = (o & 1) || (o == 0);
8406 o_conv = InMemorySigner_clone(&o_conv);
8407 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8408 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8409 return (long)ret_conv;
8412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8413 LDKDecodeError e_conv;
8414 e_conv.inner = (void*)(e & (~1));
8415 e_conv.is_owned = (e & 1) || (e == 0);
8416 e_conv = DecodeError_clone(&e_conv);
8417 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8418 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8419 return (long)ret_conv;
8422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8423 if ((_res & 1) != 0) return;
8424 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8426 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8430 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8431 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8432 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8433 return (long)ret_conv;
8436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8437 LDKCVec_TxOutZ _res_constr;
8438 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8439 if (_res_constr.datalen > 0)
8440 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8442 _res_constr.data = NULL;
8443 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8444 for (size_t h = 0; h < _res_constr.datalen; h++) {
8445 int64_t _res_conv_7 = _res_vals[h];
8446 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8447 FREE((void*)_res_conv_7);
8448 _res_constr.data[h] = _res_conv_7_conv;
8450 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8451 CVec_TxOutZ_free(_res_constr);
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8455 LDKTransaction o_ref;
8456 o_ref.datalen = (*env)->GetArrayLength(env, o);
8457 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8458 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
8459 o_ref.data_is_owned = true;
8460 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8461 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8462 return (long)ret_conv;
8465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
8466 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8467 *ret_conv = CResult_TransactionNoneZ_err();
8468 return (long)ret_conv;
8471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8472 if ((_res & 1) != 0) return;
8473 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8475 CResult_TransactionNoneZ_free(_res_conv);
8478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8479 LDKCVec_RouteHopZ _res_constr;
8480 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8481 if (_res_constr.datalen > 0)
8482 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8484 _res_constr.data = NULL;
8485 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8486 for (size_t k = 0; k < _res_constr.datalen; k++) {
8487 int64_t _res_conv_10 = _res_vals[k];
8488 LDKRouteHop _res_conv_10_conv;
8489 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8490 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8491 _res_constr.data[k] = _res_conv_10_conv;
8493 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8494 CVec_RouteHopZ_free(_res_constr);
8497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8498 LDKCVec_CVec_RouteHopZZ _res_constr;
8499 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8500 if (_res_constr.datalen > 0)
8501 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8503 _res_constr.data = NULL;
8504 for (size_t m = 0; m < _res_constr.datalen; m++) {
8505 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
8506 LDKCVec_RouteHopZ _res_conv_12_constr;
8507 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
8508 if (_res_conv_12_constr.datalen > 0)
8509 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8511 _res_conv_12_constr.data = NULL;
8512 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
8513 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8514 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8515 LDKRouteHop _res_conv_12_conv_10_conv;
8516 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8517 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8518 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8520 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
8521 _res_constr.data[m] = _res_conv_12_constr;
8523 CVec_CVec_RouteHopZZ_free(_res_constr);
8526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8528 o_conv.inner = (void*)(o & (~1));
8529 o_conv.is_owned = (o & 1) || (o == 0);
8530 o_conv = Route_clone(&o_conv);
8531 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8532 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8533 return (long)ret_conv;
8536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8537 LDKDecodeError e_conv;
8538 e_conv.inner = (void*)(e & (~1));
8539 e_conv.is_owned = (e & 1) || (e == 0);
8540 e_conv = DecodeError_clone(&e_conv);
8541 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8542 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8543 return (long)ret_conv;
8546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8547 if ((_res & 1) != 0) return;
8548 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
8550 CResult_RouteDecodeErrorZ_free(_res_conv);
8553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8554 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8555 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8556 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8557 return (long)ret_conv;
8560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8561 LDKCVec_RouteHintZ _res_constr;
8562 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8563 if (_res_constr.datalen > 0)
8564 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8566 _res_constr.data = NULL;
8567 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8568 for (size_t l = 0; l < _res_constr.datalen; l++) {
8569 int64_t _res_conv_11 = _res_vals[l];
8570 LDKRouteHint _res_conv_11_conv;
8571 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8572 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8573 _res_constr.data[l] = _res_conv_11_conv;
8575 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8576 CVec_RouteHintZ_free(_res_constr);
8579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8581 o_conv.inner = (void*)(o & (~1));
8582 o_conv.is_owned = (o & 1) || (o == 0);
8583 o_conv = Route_clone(&o_conv);
8584 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8585 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8586 return (long)ret_conv;
8589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8590 LDKLightningError e_conv;
8591 e_conv.inner = (void*)(e & (~1));
8592 e_conv.is_owned = (e & 1) || (e == 0);
8593 e_conv = LightningError_clone(&e_conv);
8594 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8595 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8596 return (long)ret_conv;
8599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8600 if ((_res & 1) != 0) return;
8601 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8603 CResult_RouteLightningErrorZ_free(_res_conv);
8606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8607 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8608 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8609 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8610 return (long)ret_conv;
8613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
8614 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
8616 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8617 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
8618 return (long)ret_conv;
8621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
8622 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8623 *ret_conv = CResult_NetAddressu8Z_err(e);
8624 return (long)ret_conv;
8627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8628 if ((_res & 1) != 0) return;
8629 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
8631 CResult_NetAddressu8Z_free(_res_conv);
8634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8635 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
8636 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8637 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
8638 return (long)ret_conv;
8641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8642 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
8644 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8645 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
8646 return (long)ret_conv;
8649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8650 LDKDecodeError e_conv;
8651 e_conv.inner = (void*)(e & (~1));
8652 e_conv.is_owned = (e & 1) || (e == 0);
8653 e_conv = DecodeError_clone(&e_conv);
8654 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8655 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
8656 return (long)ret_conv;
8659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8660 if ((_res & 1) != 0) return;
8661 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8663 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
8666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8667 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
8668 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8669 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
8670 return (long)ret_conv;
8673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8674 LDKCVec_UpdateAddHTLCZ _res_constr;
8675 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8676 if (_res_constr.datalen > 0)
8677 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
8679 _res_constr.data = NULL;
8680 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8681 for (size_t p = 0; p < _res_constr.datalen; p++) {
8682 int64_t _res_conv_15 = _res_vals[p];
8683 LDKUpdateAddHTLC _res_conv_15_conv;
8684 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
8685 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
8686 _res_constr.data[p] = _res_conv_15_conv;
8688 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8689 CVec_UpdateAddHTLCZ_free(_res_constr);
8692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8693 LDKCVec_UpdateFulfillHTLCZ _res_constr;
8694 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8695 if (_res_constr.datalen > 0)
8696 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
8698 _res_constr.data = NULL;
8699 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8700 for (size_t t = 0; t < _res_constr.datalen; t++) {
8701 int64_t _res_conv_19 = _res_vals[t];
8702 LDKUpdateFulfillHTLC _res_conv_19_conv;
8703 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
8704 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
8705 _res_constr.data[t] = _res_conv_19_conv;
8707 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8708 CVec_UpdateFulfillHTLCZ_free(_res_constr);
8711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8712 LDKCVec_UpdateFailHTLCZ _res_constr;
8713 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8714 if (_res_constr.datalen > 0)
8715 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
8717 _res_constr.data = NULL;
8718 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8719 for (size_t q = 0; q < _res_constr.datalen; q++) {
8720 int64_t _res_conv_16 = _res_vals[q];
8721 LDKUpdateFailHTLC _res_conv_16_conv;
8722 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8723 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8724 _res_constr.data[q] = _res_conv_16_conv;
8726 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8727 CVec_UpdateFailHTLCZ_free(_res_constr);
8730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8731 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
8732 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8733 if (_res_constr.datalen > 0)
8734 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
8736 _res_constr.data = NULL;
8737 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8738 for (size_t z = 0; z < _res_constr.datalen; z++) {
8739 int64_t _res_conv_25 = _res_vals[z];
8740 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
8741 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
8742 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
8743 _res_constr.data[z] = _res_conv_25_conv;
8745 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8746 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
8749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8750 LDKAcceptChannel o_conv;
8751 o_conv.inner = (void*)(o & (~1));
8752 o_conv.is_owned = (o & 1) || (o == 0);
8753 o_conv = AcceptChannel_clone(&o_conv);
8754 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8755 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
8756 return (long)ret_conv;
8759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8760 LDKDecodeError e_conv;
8761 e_conv.inner = (void*)(e & (~1));
8762 e_conv.is_owned = (e & 1) || (e == 0);
8763 e_conv = DecodeError_clone(&e_conv);
8764 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8765 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
8766 return (long)ret_conv;
8769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8770 if ((_res & 1) != 0) return;
8771 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8773 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
8776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8777 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
8778 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8779 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
8780 return (long)ret_conv;
8783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8784 LDKAnnouncementSignatures o_conv;
8785 o_conv.inner = (void*)(o & (~1));
8786 o_conv.is_owned = (o & 1) || (o == 0);
8787 o_conv = AnnouncementSignatures_clone(&o_conv);
8788 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8789 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
8790 return (long)ret_conv;
8793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8794 LDKDecodeError e_conv;
8795 e_conv.inner = (void*)(e & (~1));
8796 e_conv.is_owned = (e & 1) || (e == 0);
8797 e_conv = DecodeError_clone(&e_conv);
8798 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8799 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
8800 return (long)ret_conv;
8803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8804 if ((_res & 1) != 0) return;
8805 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8807 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
8810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8811 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
8812 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8813 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
8814 return (long)ret_conv;
8817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8818 LDKChannelReestablish o_conv;
8819 o_conv.inner = (void*)(o & (~1));
8820 o_conv.is_owned = (o & 1) || (o == 0);
8821 o_conv = ChannelReestablish_clone(&o_conv);
8822 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8823 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
8824 return (long)ret_conv;
8827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8828 LDKDecodeError e_conv;
8829 e_conv.inner = (void*)(e & (~1));
8830 e_conv.is_owned = (e & 1) || (e == 0);
8831 e_conv = DecodeError_clone(&e_conv);
8832 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8833 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
8834 return (long)ret_conv;
8837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8838 if ((_res & 1) != 0) return;
8839 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
8841 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
8844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8845 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
8846 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8847 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
8848 return (long)ret_conv;
8851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8852 LDKClosingSigned o_conv;
8853 o_conv.inner = (void*)(o & (~1));
8854 o_conv.is_owned = (o & 1) || (o == 0);
8855 o_conv = ClosingSigned_clone(&o_conv);
8856 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8857 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
8858 return (long)ret_conv;
8861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8862 LDKDecodeError e_conv;
8863 e_conv.inner = (void*)(e & (~1));
8864 e_conv.is_owned = (e & 1) || (e == 0);
8865 e_conv = DecodeError_clone(&e_conv);
8866 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8867 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
8868 return (long)ret_conv;
8871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8872 if ((_res & 1) != 0) return;
8873 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8875 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
8878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8879 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
8880 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8881 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
8882 return (long)ret_conv;
8885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8886 LDKCommitmentSigned o_conv;
8887 o_conv.inner = (void*)(o & (~1));
8888 o_conv.is_owned = (o & 1) || (o == 0);
8889 o_conv = CommitmentSigned_clone(&o_conv);
8890 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8891 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
8892 return (long)ret_conv;
8895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8896 LDKDecodeError e_conv;
8897 e_conv.inner = (void*)(e & (~1));
8898 e_conv.is_owned = (e & 1) || (e == 0);
8899 e_conv = DecodeError_clone(&e_conv);
8900 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8901 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
8902 return (long)ret_conv;
8905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8906 if ((_res & 1) != 0) return;
8907 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8909 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
8912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8913 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
8914 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8915 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
8916 return (long)ret_conv;
8919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8920 LDKFundingCreated o_conv;
8921 o_conv.inner = (void*)(o & (~1));
8922 o_conv.is_owned = (o & 1) || (o == 0);
8923 o_conv = FundingCreated_clone(&o_conv);
8924 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8925 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
8926 return (long)ret_conv;
8929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8930 LDKDecodeError e_conv;
8931 e_conv.inner = (void*)(e & (~1));
8932 e_conv.is_owned = (e & 1) || (e == 0);
8933 e_conv = DecodeError_clone(&e_conv);
8934 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8935 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
8936 return (long)ret_conv;
8939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8940 if ((_res & 1) != 0) return;
8941 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8943 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8947 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
8948 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8949 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
8950 return (long)ret_conv;
8953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8954 LDKFundingSigned o_conv;
8955 o_conv.inner = (void*)(o & (~1));
8956 o_conv.is_owned = (o & 1) || (o == 0);
8957 o_conv = FundingSigned_clone(&o_conv);
8958 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8959 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
8960 return (long)ret_conv;
8963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8964 LDKDecodeError e_conv;
8965 e_conv.inner = (void*)(e & (~1));
8966 e_conv.is_owned = (e & 1) || (e == 0);
8967 e_conv = DecodeError_clone(&e_conv);
8968 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8969 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
8970 return (long)ret_conv;
8973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8974 if ((_res & 1) != 0) return;
8975 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8977 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
8980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8981 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
8982 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8983 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
8984 return (long)ret_conv;
8987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8988 LDKFundingLocked o_conv;
8989 o_conv.inner = (void*)(o & (~1));
8990 o_conv.is_owned = (o & 1) || (o == 0);
8991 o_conv = FundingLocked_clone(&o_conv);
8992 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8993 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
8994 return (long)ret_conv;
8997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8998 LDKDecodeError e_conv;
8999 e_conv.inner = (void*)(e & (~1));
9000 e_conv.is_owned = (e & 1) || (e == 0);
9001 e_conv = DecodeError_clone(&e_conv);
9002 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9003 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
9004 return (long)ret_conv;
9007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9008 if ((_res & 1) != 0) return;
9009 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9011 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
9014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9015 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
9016 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9017 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
9018 return (long)ret_conv;
9021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9023 o_conv.inner = (void*)(o & (~1));
9024 o_conv.is_owned = (o & 1) || (o == 0);
9025 o_conv = Init_clone(&o_conv);
9026 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9027 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
9028 return (long)ret_conv;
9031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9032 LDKDecodeError e_conv;
9033 e_conv.inner = (void*)(e & (~1));
9034 e_conv.is_owned = (e & 1) || (e == 0);
9035 e_conv = DecodeError_clone(&e_conv);
9036 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9037 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
9038 return (long)ret_conv;
9041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9042 if ((_res & 1) != 0) return;
9043 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
9045 CResult_InitDecodeErrorZ_free(_res_conv);
9048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9049 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
9050 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9051 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
9052 return (long)ret_conv;
9055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9056 LDKOpenChannel o_conv;
9057 o_conv.inner = (void*)(o & (~1));
9058 o_conv.is_owned = (o & 1) || (o == 0);
9059 o_conv = OpenChannel_clone(&o_conv);
9060 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9061 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
9062 return (long)ret_conv;
9065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9066 LDKDecodeError e_conv;
9067 e_conv.inner = (void*)(e & (~1));
9068 e_conv.is_owned = (e & 1) || (e == 0);
9069 e_conv = DecodeError_clone(&e_conv);
9070 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9071 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
9072 return (long)ret_conv;
9075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9076 if ((_res & 1) != 0) return;
9077 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9079 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
9082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9083 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
9084 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9085 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
9086 return (long)ret_conv;
9089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9090 LDKRevokeAndACK o_conv;
9091 o_conv.inner = (void*)(o & (~1));
9092 o_conv.is_owned = (o & 1) || (o == 0);
9093 o_conv = RevokeAndACK_clone(&o_conv);
9094 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9095 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
9096 return (long)ret_conv;
9099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9100 LDKDecodeError e_conv;
9101 e_conv.inner = (void*)(e & (~1));
9102 e_conv.is_owned = (e & 1) || (e == 0);
9103 e_conv = DecodeError_clone(&e_conv);
9104 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9105 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
9106 return (long)ret_conv;
9109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9110 if ((_res & 1) != 0) return;
9111 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
9113 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
9116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9117 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
9118 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9119 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
9120 return (long)ret_conv;
9123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9125 o_conv.inner = (void*)(o & (~1));
9126 o_conv.is_owned = (o & 1) || (o == 0);
9127 o_conv = Shutdown_clone(&o_conv);
9128 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9129 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
9130 return (long)ret_conv;
9133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9134 LDKDecodeError e_conv;
9135 e_conv.inner = (void*)(e & (~1));
9136 e_conv.is_owned = (e & 1) || (e == 0);
9137 e_conv = DecodeError_clone(&e_conv);
9138 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9139 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
9140 return (long)ret_conv;
9143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9144 if ((_res & 1) != 0) return;
9145 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
9147 CResult_ShutdownDecodeErrorZ_free(_res_conv);
9150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9151 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
9152 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9153 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
9154 return (long)ret_conv;
9157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9158 LDKUpdateFailHTLC o_conv;
9159 o_conv.inner = (void*)(o & (~1));
9160 o_conv.is_owned = (o & 1) || (o == 0);
9161 o_conv = UpdateFailHTLC_clone(&o_conv);
9162 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9163 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
9164 return (long)ret_conv;
9167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9168 LDKDecodeError e_conv;
9169 e_conv.inner = (void*)(e & (~1));
9170 e_conv.is_owned = (e & 1) || (e == 0);
9171 e_conv = DecodeError_clone(&e_conv);
9172 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9173 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
9174 return (long)ret_conv;
9177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9178 if ((_res & 1) != 0) return;
9179 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9181 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
9184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9185 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
9186 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9187 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
9188 return (long)ret_conv;
9191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9192 LDKUpdateFailMalformedHTLC o_conv;
9193 o_conv.inner = (void*)(o & (~1));
9194 o_conv.is_owned = (o & 1) || (o == 0);
9195 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
9196 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9197 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
9198 return (long)ret_conv;
9201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9202 LDKDecodeError e_conv;
9203 e_conv.inner = (void*)(e & (~1));
9204 e_conv.is_owned = (e & 1) || (e == 0);
9205 e_conv = DecodeError_clone(&e_conv);
9206 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9207 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
9208 return (long)ret_conv;
9211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9212 if ((_res & 1) != 0) return;
9213 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9215 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
9218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9219 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
9220 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9221 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
9222 return (long)ret_conv;
9225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9226 LDKUpdateFee o_conv;
9227 o_conv.inner = (void*)(o & (~1));
9228 o_conv.is_owned = (o & 1) || (o == 0);
9229 o_conv = UpdateFee_clone(&o_conv);
9230 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9231 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
9232 return (long)ret_conv;
9235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9236 LDKDecodeError e_conv;
9237 e_conv.inner = (void*)(e & (~1));
9238 e_conv.is_owned = (e & 1) || (e == 0);
9239 e_conv = DecodeError_clone(&e_conv);
9240 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9241 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
9242 return (long)ret_conv;
9245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9246 if ((_res & 1) != 0) return;
9247 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9249 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
9252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9253 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
9254 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9255 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
9256 return (long)ret_conv;
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9260 LDKUpdateFulfillHTLC o_conv;
9261 o_conv.inner = (void*)(o & (~1));
9262 o_conv.is_owned = (o & 1) || (o == 0);
9263 o_conv = UpdateFulfillHTLC_clone(&o_conv);
9264 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9265 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
9266 return (long)ret_conv;
9269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9270 LDKDecodeError e_conv;
9271 e_conv.inner = (void*)(e & (~1));
9272 e_conv.is_owned = (e & 1) || (e == 0);
9273 e_conv = DecodeError_clone(&e_conv);
9274 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9275 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
9276 return (long)ret_conv;
9279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9280 if ((_res & 1) != 0) return;
9281 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9283 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
9286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9287 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
9288 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9289 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
9290 return (long)ret_conv;
9293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9294 LDKUpdateAddHTLC o_conv;
9295 o_conv.inner = (void*)(o & (~1));
9296 o_conv.is_owned = (o & 1) || (o == 0);
9297 o_conv = UpdateAddHTLC_clone(&o_conv);
9298 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9299 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
9300 return (long)ret_conv;
9303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9304 LDKDecodeError e_conv;
9305 e_conv.inner = (void*)(e & (~1));
9306 e_conv.is_owned = (e & 1) || (e == 0);
9307 e_conv = DecodeError_clone(&e_conv);
9308 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9309 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
9310 return (long)ret_conv;
9313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9314 if ((_res & 1) != 0) return;
9315 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9317 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
9320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9321 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
9322 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9323 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
9324 return (long)ret_conv;
9327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9329 o_conv.inner = (void*)(o & (~1));
9330 o_conv.is_owned = (o & 1) || (o == 0);
9331 o_conv = Ping_clone(&o_conv);
9332 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9333 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
9334 return (long)ret_conv;
9337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9338 LDKDecodeError e_conv;
9339 e_conv.inner = (void*)(e & (~1));
9340 e_conv.is_owned = (e & 1) || (e == 0);
9341 e_conv = DecodeError_clone(&e_conv);
9342 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9343 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
9344 return (long)ret_conv;
9347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9348 if ((_res & 1) != 0) return;
9349 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
9351 CResult_PingDecodeErrorZ_free(_res_conv);
9354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9355 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
9356 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9357 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
9358 return (long)ret_conv;
9361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9363 o_conv.inner = (void*)(o & (~1));
9364 o_conv.is_owned = (o & 1) || (o == 0);
9365 o_conv = Pong_clone(&o_conv);
9366 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9367 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
9368 return (long)ret_conv;
9371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9372 LDKDecodeError e_conv;
9373 e_conv.inner = (void*)(e & (~1));
9374 e_conv.is_owned = (e & 1) || (e == 0);
9375 e_conv = DecodeError_clone(&e_conv);
9376 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9377 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
9378 return (long)ret_conv;
9381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9382 if ((_res & 1) != 0) return;
9383 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
9385 CResult_PongDecodeErrorZ_free(_res_conv);
9388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9389 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
9390 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9391 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
9392 return (long)ret_conv;
9395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9396 LDKUnsignedChannelAnnouncement o_conv;
9397 o_conv.inner = (void*)(o & (~1));
9398 o_conv.is_owned = (o & 1) || (o == 0);
9399 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
9400 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9401 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
9402 return (long)ret_conv;
9405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9406 LDKDecodeError e_conv;
9407 e_conv.inner = (void*)(e & (~1));
9408 e_conv.is_owned = (e & 1) || (e == 0);
9409 e_conv = DecodeError_clone(&e_conv);
9410 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9411 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
9412 return (long)ret_conv;
9415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9416 if ((_res & 1) != 0) return;
9417 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9419 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
9422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9423 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9424 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9425 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9426 return (long)ret_conv;
9429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9430 LDKChannelAnnouncement o_conv;
9431 o_conv.inner = (void*)(o & (~1));
9432 o_conv.is_owned = (o & 1) || (o == 0);
9433 o_conv = ChannelAnnouncement_clone(&o_conv);
9434 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9435 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
9436 return (long)ret_conv;
9439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9440 LDKDecodeError e_conv;
9441 e_conv.inner = (void*)(e & (~1));
9442 e_conv.is_owned = (e & 1) || (e == 0);
9443 e_conv = DecodeError_clone(&e_conv);
9444 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9445 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
9446 return (long)ret_conv;
9449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9450 if ((_res & 1) != 0) return;
9451 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9453 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
9456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9457 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9458 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9459 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9460 return (long)ret_conv;
9463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9464 LDKUnsignedChannelUpdate o_conv;
9465 o_conv.inner = (void*)(o & (~1));
9466 o_conv.is_owned = (o & 1) || (o == 0);
9467 o_conv = UnsignedChannelUpdate_clone(&o_conv);
9468 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9469 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
9470 return (long)ret_conv;
9473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9474 LDKDecodeError e_conv;
9475 e_conv.inner = (void*)(e & (~1));
9476 e_conv.is_owned = (e & 1) || (e == 0);
9477 e_conv = DecodeError_clone(&e_conv);
9478 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9479 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
9480 return (long)ret_conv;
9483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9484 if ((_res & 1) != 0) return;
9485 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9487 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
9490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9491 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
9492 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9493 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
9494 return (long)ret_conv;
9497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9498 LDKChannelUpdate o_conv;
9499 o_conv.inner = (void*)(o & (~1));
9500 o_conv.is_owned = (o & 1) || (o == 0);
9501 o_conv = ChannelUpdate_clone(&o_conv);
9502 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9503 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
9504 return (long)ret_conv;
9507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9508 LDKDecodeError e_conv;
9509 e_conv.inner = (void*)(e & (~1));
9510 e_conv.is_owned = (e & 1) || (e == 0);
9511 e_conv = DecodeError_clone(&e_conv);
9512 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9513 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
9514 return (long)ret_conv;
9517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9518 if ((_res & 1) != 0) return;
9519 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9521 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
9524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9525 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
9526 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9527 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
9528 return (long)ret_conv;
9531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9532 LDKErrorMessage o_conv;
9533 o_conv.inner = (void*)(o & (~1));
9534 o_conv.is_owned = (o & 1) || (o == 0);
9535 o_conv = ErrorMessage_clone(&o_conv);
9536 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9537 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
9538 return (long)ret_conv;
9541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9542 LDKDecodeError e_conv;
9543 e_conv.inner = (void*)(e & (~1));
9544 e_conv.is_owned = (e & 1) || (e == 0);
9545 e_conv = DecodeError_clone(&e_conv);
9546 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9547 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
9548 return (long)ret_conv;
9551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9552 if ((_res & 1) != 0) return;
9553 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
9555 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
9558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9559 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
9560 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9561 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
9562 return (long)ret_conv;
9565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9566 LDKUnsignedNodeAnnouncement o_conv;
9567 o_conv.inner = (void*)(o & (~1));
9568 o_conv.is_owned = (o & 1) || (o == 0);
9569 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
9570 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9571 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
9572 return (long)ret_conv;
9575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9576 LDKDecodeError e_conv;
9577 e_conv.inner = (void*)(e & (~1));
9578 e_conv.is_owned = (e & 1) || (e == 0);
9579 e_conv = DecodeError_clone(&e_conv);
9580 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9581 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
9582 return (long)ret_conv;
9585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9586 if ((_res & 1) != 0) return;
9587 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9589 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
9592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9593 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
9594 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9595 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
9596 return (long)ret_conv;
9599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9600 LDKNodeAnnouncement o_conv;
9601 o_conv.inner = (void*)(o & (~1));
9602 o_conv.is_owned = (o & 1) || (o == 0);
9603 o_conv = NodeAnnouncement_clone(&o_conv);
9604 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9605 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
9606 return (long)ret_conv;
9609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9610 LDKDecodeError e_conv;
9611 e_conv.inner = (void*)(e & (~1));
9612 e_conv.is_owned = (e & 1) || (e == 0);
9613 e_conv = DecodeError_clone(&e_conv);
9614 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9615 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
9616 return (long)ret_conv;
9619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9620 if ((_res & 1) != 0) return;
9621 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9623 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
9626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9627 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
9628 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9629 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
9630 return (long)ret_conv;
9633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9634 LDKQueryShortChannelIds o_conv;
9635 o_conv.inner = (void*)(o & (~1));
9636 o_conv.is_owned = (o & 1) || (o == 0);
9637 o_conv = QueryShortChannelIds_clone(&o_conv);
9638 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9639 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
9640 return (long)ret_conv;
9643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9644 LDKDecodeError e_conv;
9645 e_conv.inner = (void*)(e & (~1));
9646 e_conv.is_owned = (e & 1) || (e == 0);
9647 e_conv = DecodeError_clone(&e_conv);
9648 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9649 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
9650 return (long)ret_conv;
9653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9654 if ((_res & 1) != 0) return;
9655 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
9657 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
9660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9661 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
9662 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9663 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
9664 return (long)ret_conv;
9667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9668 LDKReplyShortChannelIdsEnd o_conv;
9669 o_conv.inner = (void*)(o & (~1));
9670 o_conv.is_owned = (o & 1) || (o == 0);
9671 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
9672 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9673 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
9674 return (long)ret_conv;
9677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9678 LDKDecodeError e_conv;
9679 e_conv.inner = (void*)(e & (~1));
9680 e_conv.is_owned = (e & 1) || (e == 0);
9681 e_conv = DecodeError_clone(&e_conv);
9682 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9683 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
9684 return (long)ret_conv;
9687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9688 if ((_res & 1) != 0) return;
9689 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
9691 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
9694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9695 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
9696 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9697 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
9698 return (long)ret_conv;
9701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9702 LDKQueryChannelRange o_conv;
9703 o_conv.inner = (void*)(o & (~1));
9704 o_conv.is_owned = (o & 1) || (o == 0);
9705 o_conv = QueryChannelRange_clone(&o_conv);
9706 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9707 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
9708 return (long)ret_conv;
9711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9712 LDKDecodeError e_conv;
9713 e_conv.inner = (void*)(e & (~1));
9714 e_conv.is_owned = (e & 1) || (e == 0);
9715 e_conv = DecodeError_clone(&e_conv);
9716 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9717 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
9718 return (long)ret_conv;
9721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9722 if ((_res & 1) != 0) return;
9723 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9725 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
9728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9729 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
9730 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9731 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
9732 return (long)ret_conv;
9735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9736 LDKReplyChannelRange o_conv;
9737 o_conv.inner = (void*)(o & (~1));
9738 o_conv.is_owned = (o & 1) || (o == 0);
9739 o_conv = ReplyChannelRange_clone(&o_conv);
9740 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9741 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
9742 return (long)ret_conv;
9745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9746 LDKDecodeError e_conv;
9747 e_conv.inner = (void*)(e & (~1));
9748 e_conv.is_owned = (e & 1) || (e == 0);
9749 e_conv = DecodeError_clone(&e_conv);
9750 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9751 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
9752 return (long)ret_conv;
9755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9756 if ((_res & 1) != 0) return;
9757 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9759 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
9762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9763 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
9764 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9765 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
9766 return (long)ret_conv;
9769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9770 LDKGossipTimestampFilter o_conv;
9771 o_conv.inner = (void*)(o & (~1));
9772 o_conv.is_owned = (o & 1) || (o == 0);
9773 o_conv = GossipTimestampFilter_clone(&o_conv);
9774 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9775 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
9776 return (long)ret_conv;
9779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9780 LDKDecodeError e_conv;
9781 e_conv.inner = (void*)(e & (~1));
9782 e_conv.is_owned = (e & 1) || (e == 0);
9783 e_conv = DecodeError_clone(&e_conv);
9784 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9785 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
9786 return (long)ret_conv;
9789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9790 if ((_res & 1) != 0) return;
9791 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
9793 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
9796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9797 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
9798 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9799 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
9800 return (long)ret_conv;
9803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9804 if ((this_ptr & 1) != 0) return;
9805 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9806 FREE((void*)this_ptr);
9807 Event_free(this_ptr_conv);
9810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9811 LDKEvent* orig_conv = (LDKEvent*)orig;
9812 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9813 *ret_copy = Event_clone(orig_conv);
9814 long ret_ref = (long)ret_copy;
9818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
9819 LDKEvent* obj_conv = (LDKEvent*)obj;
9820 LDKCVec_u8Z ret_var = Event_write(obj_conv);
9821 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9822 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9823 CVec_u8Z_free(ret_var);
9827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9828 if ((this_ptr & 1) != 0) return;
9829 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9830 FREE((void*)this_ptr);
9831 MessageSendEvent_free(this_ptr_conv);
9834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9835 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9836 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9837 *ret_copy = MessageSendEvent_clone(orig_conv);
9838 long ret_ref = (long)ret_copy;
9842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9843 if ((this_ptr & 1) != 0) return;
9844 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9845 FREE((void*)this_ptr);
9846 MessageSendEventsProvider_free(this_ptr_conv);
9849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9850 if ((this_ptr & 1) != 0) return;
9851 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9852 FREE((void*)this_ptr);
9853 EventsProvider_free(this_ptr_conv);
9856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9857 if ((this_ptr & 1) != 0) return;
9858 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9859 FREE((void*)this_ptr);
9860 APIError_free(this_ptr_conv);
9863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9864 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9865 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9866 *ret_copy = APIError_clone(orig_conv);
9867 long ret_ref = (long)ret_copy;
9871 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9872 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9873 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
9877 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
9878 jclass ret_conv = LDKLevel_to_java(env, Level_max());
9882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9883 if ((this_ptr & 1) != 0) return;
9884 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9885 FREE((void*)this_ptr);
9886 Logger_free(this_ptr_conv);
9889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
9890 LDKChannelHandshakeConfig this_obj_conv;
9891 this_obj_conv.inner = (void*)(this_obj & (~1));
9892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9893 ChannelHandshakeConfig_free(this_obj_conv);
9896 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9897 LDKChannelHandshakeConfig this_ptr_conv;
9898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9899 this_ptr_conv.is_owned = false;
9900 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9905 LDKChannelHandshakeConfig this_ptr_conv;
9906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9907 this_ptr_conv.is_owned = false;
9908 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9911 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9912 LDKChannelHandshakeConfig this_ptr_conv;
9913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9914 this_ptr_conv.is_owned = false;
9915 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9919 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) {
9920 LDKChannelHandshakeConfig this_ptr_conv;
9921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9922 this_ptr_conv.is_owned = false;
9923 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9927 LDKChannelHandshakeConfig this_ptr_conv;
9928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9929 this_ptr_conv.is_owned = false;
9930 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9934 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) {
9935 LDKChannelHandshakeConfig this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = false;
9938 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9941 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) {
9942 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9945 long ret_ref = (long)ret_var.inner;
9946 if (ret_var.is_owned) {
9952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9953 LDKChannelHandshakeConfig orig_conv;
9954 orig_conv.inner = (void*)(orig & (~1));
9955 orig_conv.is_owned = false;
9956 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9959 long ret_ref = (long)ret_var.inner;
9960 if (ret_var.is_owned) {
9966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
9967 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9970 long ret_ref = (long)ret_var.inner;
9971 if (ret_var.is_owned) {
9977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
9978 LDKChannelHandshakeLimits this_obj_conv;
9979 this_obj_conv.inner = (void*)(this_obj & (~1));
9980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9981 ChannelHandshakeLimits_free(this_obj_conv);
9984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9985 LDKChannelHandshakeLimits this_ptr_conv;
9986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9987 this_ptr_conv.is_owned = false;
9988 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9993 LDKChannelHandshakeLimits this_ptr_conv;
9994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9995 this_ptr_conv.is_owned = false;
9996 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10000 LDKChannelHandshakeLimits this_ptr_conv;
10001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10002 this_ptr_conv.is_owned = false;
10003 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
10007 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) {
10008 LDKChannelHandshakeLimits this_ptr_conv;
10009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10010 this_ptr_conv.is_owned = false;
10011 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
10014 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) {
10015 LDKChannelHandshakeLimits this_ptr_conv;
10016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10017 this_ptr_conv.is_owned = false;
10018 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
10022 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) {
10023 LDKChannelHandshakeLimits this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = false;
10026 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10030 LDKChannelHandshakeLimits this_ptr_conv;
10031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10032 this_ptr_conv.is_owned = false;
10033 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
10037 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) {
10038 LDKChannelHandshakeLimits this_ptr_conv;
10039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10040 this_ptr_conv.is_owned = false;
10041 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
10044 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10045 LDKChannelHandshakeLimits this_ptr_conv;
10046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10047 this_ptr_conv.is_owned = false;
10048 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
10052 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) {
10053 LDKChannelHandshakeLimits this_ptr_conv;
10054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10055 this_ptr_conv.is_owned = false;
10056 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
10059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10060 LDKChannelHandshakeLimits this_ptr_conv;
10061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10062 this_ptr_conv.is_owned = false;
10063 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
10067 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) {
10068 LDKChannelHandshakeLimits this_ptr_conv;
10069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10070 this_ptr_conv.is_owned = false;
10071 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
10074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10075 LDKChannelHandshakeLimits this_ptr_conv;
10076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10077 this_ptr_conv.is_owned = false;
10078 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
10082 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) {
10083 LDKChannelHandshakeLimits this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = false;
10086 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
10089 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10090 LDKChannelHandshakeLimits this_ptr_conv;
10091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10092 this_ptr_conv.is_owned = false;
10093 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
10097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10098 LDKChannelHandshakeLimits this_ptr_conv;
10099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10100 this_ptr_conv.is_owned = false;
10101 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
10104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
10105 LDKChannelHandshakeLimits this_ptr_conv;
10106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10107 this_ptr_conv.is_owned = false;
10108 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
10112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10113 LDKChannelHandshakeLimits this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = false;
10116 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
10119 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10120 LDKChannelHandshakeLimits this_ptr_conv;
10121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10122 this_ptr_conv.is_owned = false;
10123 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
10127 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) {
10128 LDKChannelHandshakeLimits this_ptr_conv;
10129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10130 this_ptr_conv.is_owned = false;
10131 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
10134 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) {
10135 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);
10136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10138 long ret_ref = (long)ret_var.inner;
10139 if (ret_var.is_owned) {
10145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10146 LDKChannelHandshakeLimits orig_conv;
10147 orig_conv.inner = (void*)(orig & (~1));
10148 orig_conv.is_owned = false;
10149 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
10150 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10151 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10152 long ret_ref = (long)ret_var.inner;
10153 if (ret_var.is_owned) {
10159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
10160 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
10161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10163 long ret_ref = (long)ret_var.inner;
10164 if (ret_var.is_owned) {
10170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10171 LDKChannelConfig this_obj_conv;
10172 this_obj_conv.inner = (void*)(this_obj & (~1));
10173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10174 ChannelConfig_free(this_obj_conv);
10177 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
10178 LDKChannelConfig this_ptr_conv;
10179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10180 this_ptr_conv.is_owned = false;
10181 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
10185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10186 LDKChannelConfig this_ptr_conv;
10187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10188 this_ptr_conv.is_owned = false;
10189 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
10192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
10193 LDKChannelConfig this_ptr_conv;
10194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10195 this_ptr_conv.is_owned = false;
10196 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
10200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10201 LDKChannelConfig this_ptr_conv;
10202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10203 this_ptr_conv.is_owned = false;
10204 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
10207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10208 LDKChannelConfig this_ptr_conv;
10209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10210 this_ptr_conv.is_owned = false;
10211 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
10215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10216 LDKChannelConfig this_ptr_conv;
10217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10218 this_ptr_conv.is_owned = false;
10219 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
10222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
10223 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
10224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10226 long ret_ref = (long)ret_var.inner;
10227 if (ret_var.is_owned) {
10233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10234 LDKChannelConfig orig_conv;
10235 orig_conv.inner = (void*)(orig & (~1));
10236 orig_conv.is_owned = false;
10237 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
10238 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10239 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10240 long ret_ref = (long)ret_var.inner;
10241 if (ret_var.is_owned) {
10247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
10248 LDKChannelConfig ret_var = ChannelConfig_default();
10249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10251 long ret_ref = (long)ret_var.inner;
10252 if (ret_var.is_owned) {
10258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
10259 LDKChannelConfig obj_conv;
10260 obj_conv.inner = (void*)(obj & (~1));
10261 obj_conv.is_owned = false;
10262 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
10263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10265 CVec_u8Z_free(ret_var);
10269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10270 LDKu8slice ser_ref;
10271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10273 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10274 *ret_conv = ChannelConfig_read(ser_ref);
10275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10276 return (long)ret_conv;
10279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10280 LDKUserConfig this_obj_conv;
10281 this_obj_conv.inner = (void*)(this_obj & (~1));
10282 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10283 UserConfig_free(this_obj_conv);
10286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
10287 LDKUserConfig this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = false;
10290 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
10291 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10292 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10293 long ret_ref = (long)ret_var.inner;
10294 if (ret_var.is_owned) {
10300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10301 LDKUserConfig this_ptr_conv;
10302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10303 this_ptr_conv.is_owned = false;
10304 LDKChannelHandshakeConfig val_conv;
10305 val_conv.inner = (void*)(val & (~1));
10306 val_conv.is_owned = (val & 1) || (val == 0);
10307 val_conv = ChannelHandshakeConfig_clone(&val_conv);
10308 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
10311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
10312 LDKUserConfig this_ptr_conv;
10313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10314 this_ptr_conv.is_owned = false;
10315 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
10316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10318 long ret_ref = (long)ret_var.inner;
10319 if (ret_var.is_owned) {
10325 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) {
10326 LDKUserConfig this_ptr_conv;
10327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10328 this_ptr_conv.is_owned = false;
10329 LDKChannelHandshakeLimits val_conv;
10330 val_conv.inner = (void*)(val & (~1));
10331 val_conv.is_owned = (val & 1) || (val == 0);
10332 val_conv = ChannelHandshakeLimits_clone(&val_conv);
10333 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
10336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
10337 LDKUserConfig this_ptr_conv;
10338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10339 this_ptr_conv.is_owned = false;
10340 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
10341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10343 long ret_ref = (long)ret_var.inner;
10344 if (ret_var.is_owned) {
10350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10351 LDKUserConfig this_ptr_conv;
10352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10353 this_ptr_conv.is_owned = false;
10354 LDKChannelConfig val_conv;
10355 val_conv.inner = (void*)(val & (~1));
10356 val_conv.is_owned = (val & 1) || (val == 0);
10357 val_conv = ChannelConfig_clone(&val_conv);
10358 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
10361 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) {
10362 LDKChannelHandshakeConfig own_channel_config_arg_conv;
10363 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
10364 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
10365 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
10366 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
10367 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
10368 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
10369 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
10370 LDKChannelConfig channel_options_arg_conv;
10371 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
10372 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
10373 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
10374 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
10375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10377 long ret_ref = (long)ret_var.inner;
10378 if (ret_var.is_owned) {
10384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10385 LDKUserConfig orig_conv;
10386 orig_conv.inner = (void*)(orig & (~1));
10387 orig_conv.is_owned = false;
10388 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
10389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10391 long ret_ref = (long)ret_var.inner;
10392 if (ret_var.is_owned) {
10398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
10399 LDKUserConfig ret_var = UserConfig_default();
10400 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10401 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10402 long ret_ref = (long)ret_var.inner;
10403 if (ret_var.is_owned) {
10409 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10410 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
10411 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
10415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10416 if ((this_ptr & 1) != 0) return;
10417 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
10418 FREE((void*)this_ptr);
10419 Access_free(this_ptr_conv);
10422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10423 if ((this_ptr & 1) != 0) return;
10424 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
10425 FREE((void*)this_ptr);
10426 Listen_free(this_ptr_conv);
10429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10430 if ((this_ptr & 1) != 0) return;
10431 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
10432 FREE((void*)this_ptr);
10433 Watch_free(this_ptr_conv);
10436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10437 if ((this_ptr & 1) != 0) return;
10438 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
10439 FREE((void*)this_ptr);
10440 Filter_free(this_ptr_conv);
10443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10444 if ((this_ptr & 1) != 0) return;
10445 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
10446 FREE((void*)this_ptr);
10447 BroadcasterInterface_free(this_ptr_conv);
10450 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10451 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
10452 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
10456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10457 if ((this_ptr & 1) != 0) return;
10458 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
10459 FREE((void*)this_ptr);
10460 FeeEstimator_free(this_ptr_conv);
10463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10464 LDKChainMonitor this_obj_conv;
10465 this_obj_conv.inner = (void*)(this_obj & (~1));
10466 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10467 ChainMonitor_free(this_obj_conv);
10470 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) {
10471 LDKChainMonitor this_arg_conv;
10472 this_arg_conv.inner = (void*)(this_arg & (~1));
10473 this_arg_conv.is_owned = false;
10474 unsigned char header_arr[80];
10475 CHECK((*env)->GetArrayLength(env, header) == 80);
10476 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10477 unsigned char (*header_ref)[80] = &header_arr;
10478 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10479 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10480 if (txdata_constr.datalen > 0)
10481 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10483 txdata_constr.data = NULL;
10484 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10485 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10486 int64_t txdata_conv_24 = txdata_vals[y];
10487 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10488 FREE((void*)txdata_conv_24);
10489 txdata_constr.data[y] = txdata_conv_24_conv;
10491 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10492 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10495 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) {
10496 LDKChainMonitor this_arg_conv;
10497 this_arg_conv.inner = (void*)(this_arg & (~1));
10498 this_arg_conv.is_owned = false;
10499 unsigned char header_arr[80];
10500 CHECK((*env)->GetArrayLength(env, header) == 80);
10501 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10502 unsigned char (*header_ref)[80] = &header_arr;
10503 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
10506 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) {
10507 LDKFilter *chain_source_conv_ptr = NULL;
10508 if (chain_source != 0) {
10509 LDKFilter chain_source_conv;
10510 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
10511 if (chain_source_conv.free == LDKFilter_JCalls_free) {
10512 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10513 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
10515 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10516 *chain_source_conv_ptr = chain_source_conv;
10518 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10519 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10520 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10521 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10523 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10524 if (logger_conv.free == LDKLogger_JCalls_free) {
10525 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10526 LDKLogger_JCalls_clone(logger_conv.this_arg);
10528 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10529 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
10530 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10531 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
10533 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10534 if (persister_conv.free == LDKPersist_JCalls_free) {
10535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10536 LDKPersist_JCalls_clone(persister_conv.this_arg);
10538 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10541 long ret_ref = (long)ret_var.inner;
10542 if (ret_var.is_owned) {
10548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10549 LDKChainMonitor this_arg_conv;
10550 this_arg_conv.inner = (void*)(this_arg & (~1));
10551 this_arg_conv.is_owned = false;
10552 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10553 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
10558 LDKChainMonitor this_arg_conv;
10559 this_arg_conv.inner = (void*)(this_arg & (~1));
10560 this_arg_conv.is_owned = false;
10561 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10562 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10567 LDKChannelMonitorUpdate this_obj_conv;
10568 this_obj_conv.inner = (void*)(this_obj & (~1));
10569 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10570 ChannelMonitorUpdate_free(this_obj_conv);
10573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10574 LDKChannelMonitorUpdate this_ptr_conv;
10575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10576 this_ptr_conv.is_owned = false;
10577 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10582 LDKChannelMonitorUpdate this_ptr_conv;
10583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10584 this_ptr_conv.is_owned = false;
10585 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10589 LDKChannelMonitorUpdate orig_conv;
10590 orig_conv.inner = (void*)(orig & (~1));
10591 orig_conv.is_owned = false;
10592 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10595 long ret_ref = (long)ret_var.inner;
10596 if (ret_var.is_owned) {
10602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10603 LDKChannelMonitorUpdate obj_conv;
10604 obj_conv.inner = (void*)(obj & (~1));
10605 obj_conv.is_owned = false;
10606 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10607 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10608 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10609 CVec_u8Z_free(ret_var);
10613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10614 LDKu8slice ser_ref;
10615 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10616 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10617 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10618 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10619 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10620 return (long)ret_conv;
10623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10624 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10625 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
10629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10630 LDKMonitorUpdateError this_obj_conv;
10631 this_obj_conv.inner = (void*)(this_obj & (~1));
10632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10633 MonitorUpdateError_free(this_obj_conv);
10636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10637 LDKMonitorUpdateError orig_conv;
10638 orig_conv.inner = (void*)(orig & (~1));
10639 orig_conv.is_owned = false;
10640 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
10641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10643 long ret_ref = (long)ret_var.inner;
10644 if (ret_var.is_owned) {
10650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10651 if ((this_ptr & 1) != 0) return;
10652 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
10653 FREE((void*)this_ptr);
10654 MonitorEvent_free(this_ptr_conv);
10657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10658 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
10659 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10660 *ret_copy = MonitorEvent_clone(orig_conv);
10661 long ret_ref = (long)ret_copy;
10665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10666 LDKHTLCUpdate this_obj_conv;
10667 this_obj_conv.inner = (void*)(this_obj & (~1));
10668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10669 HTLCUpdate_free(this_obj_conv);
10672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10673 LDKHTLCUpdate orig_conv;
10674 orig_conv.inner = (void*)(orig & (~1));
10675 orig_conv.is_owned = false;
10676 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10679 long ret_ref = (long)ret_var.inner;
10680 if (ret_var.is_owned) {
10686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10687 LDKHTLCUpdate obj_conv;
10688 obj_conv.inner = (void*)(obj & (~1));
10689 obj_conv.is_owned = false;
10690 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
10691 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10692 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10693 CVec_u8Z_free(ret_var);
10697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10698 LDKu8slice ser_ref;
10699 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10700 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10701 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10702 *ret_conv = HTLCUpdate_read(ser_ref);
10703 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10704 return (long)ret_conv;
10707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10708 LDKChannelMonitor this_obj_conv;
10709 this_obj_conv.inner = (void*)(this_obj & (~1));
10710 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10711 ChannelMonitor_free(this_obj_conv);
10714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10715 LDKChannelMonitor orig_conv;
10716 orig_conv.inner = (void*)(orig & (~1));
10717 orig_conv.is_owned = false;
10718 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10719 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10720 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10721 long ret_ref = (long)ret_var.inner;
10722 if (ret_var.is_owned) {
10728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
10729 LDKChannelMonitor obj_conv;
10730 obj_conv.inner = (void*)(obj & (~1));
10731 obj_conv.is_owned = false;
10732 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
10733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10735 CVec_u8Z_free(ret_var);
10739 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) {
10740 LDKChannelMonitor this_arg_conv;
10741 this_arg_conv.inner = (void*)(this_arg & (~1));
10742 this_arg_conv.is_owned = false;
10743 LDKChannelMonitorUpdate updates_conv;
10744 updates_conv.inner = (void*)(updates & (~1));
10745 updates_conv.is_owned = false;
10746 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10747 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10748 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10749 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10750 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10751 return (long)ret_conv;
10754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10755 LDKChannelMonitor this_arg_conv;
10756 this_arg_conv.inner = (void*)(this_arg & (~1));
10757 this_arg_conv.is_owned = false;
10758 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
10763 LDKChannelMonitor this_arg_conv;
10764 this_arg_conv.inner = (void*)(this_arg & (~1));
10765 this_arg_conv.is_owned = false;
10766 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10767 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10768 return (long)ret_ref;
10771 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10772 LDKChannelMonitor this_arg_conv;
10773 this_arg_conv.inner = (void*)(this_arg & (~1));
10774 this_arg_conv.is_owned = false;
10775 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
10776 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10777 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10778 for (size_t v = 0; v < ret_var.datalen; v++) {
10779 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10780 *ret_conv_47_ref = ret_var.data[v];
10781 ret_arr_ptr[v] = (long)ret_conv_47_ref;
10783 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10784 FREE(ret_var.data);
10788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
10789 LDKChannelMonitor this_arg_conv;
10790 this_arg_conv.inner = (void*)(this_arg & (~1));
10791 this_arg_conv.is_owned = false;
10792 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
10793 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
10796 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10797 LDKChannelMonitor this_arg_conv;
10798 this_arg_conv.inner = (void*)(this_arg & (~1));
10799 this_arg_conv.is_owned = false;
10800 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10801 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10802 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10803 for (size_t o = 0; o < ret_var.datalen; o++) {
10804 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10805 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10806 long ret_conv_14_ref = (long)ret_conv_14_copy;
10807 ret_arr_ptr[o] = ret_conv_14_ref;
10809 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10810 FREE(ret_var.data);
10814 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10815 LDKChannelMonitor this_arg_conv;
10816 this_arg_conv.inner = (void*)(this_arg & (~1));
10817 this_arg_conv.is_owned = false;
10818 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10819 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10820 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10821 for (size_t h = 0; h < ret_var.datalen; h++) {
10822 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10823 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10824 long ret_conv_7_ref = (long)ret_conv_7_copy;
10825 ret_arr_ptr[h] = ret_conv_7_ref;
10827 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10828 FREE(ret_var.data);
10832 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) {
10833 LDKChannelMonitor this_arg_conv;
10834 this_arg_conv.inner = (void*)(this_arg & (~1));
10835 this_arg_conv.is_owned = false;
10836 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10837 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10838 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10840 for (size_t i = 0; i < ret_var.datalen; i++) {
10841 LDKTransaction ret_conv_8_var = ret_var.data[i];
10842 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
10843 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
10844 Transaction_free(ret_conv_8_var);
10845 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10847 FREE(ret_var.data);
10851 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) {
10852 LDKChannelMonitor this_arg_conv;
10853 this_arg_conv.inner = (void*)(this_arg & (~1));
10854 this_arg_conv.is_owned = false;
10855 unsigned char header_arr[80];
10856 CHECK((*env)->GetArrayLength(env, header) == 80);
10857 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10858 unsigned char (*header_ref)[80] = &header_arr;
10859 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10860 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10861 if (txdata_constr.datalen > 0)
10862 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10864 txdata_constr.data = NULL;
10865 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10866 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10867 int64_t txdata_conv_24 = txdata_vals[y];
10868 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10869 FREE((void*)txdata_conv_24);
10870 txdata_constr.data[y] = txdata_conv_24_conv;
10872 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10873 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10874 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10876 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10878 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10879 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10880 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10881 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10883 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10884 if (logger_conv.free == LDKLogger_JCalls_free) {
10885 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10886 LDKLogger_JCalls_clone(logger_conv.this_arg);
10888 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);
10889 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10890 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10891 for (size_t u = 0; u < ret_var.datalen; u++) {
10892 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10893 *ret_conv_46_ref = ret_var.data[u];
10894 ret_arr_ptr[u] = (long)ret_conv_46_ref;
10896 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10897 FREE(ret_var.data);
10901 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) {
10902 LDKChannelMonitor this_arg_conv;
10903 this_arg_conv.inner = (void*)(this_arg & (~1));
10904 this_arg_conv.is_owned = false;
10905 unsigned char header_arr[80];
10906 CHECK((*env)->GetArrayLength(env, header) == 80);
10907 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10908 unsigned char (*header_ref)[80] = &header_arr;
10909 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10910 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10911 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10912 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10914 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10915 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10916 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10917 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10919 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10920 if (logger_conv.free == LDKLogger_JCalls_free) {
10921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10922 LDKLogger_JCalls_clone(logger_conv.this_arg);
10924 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10928 if ((this_ptr & 1) != 0) return;
10929 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10930 FREE((void*)this_ptr);
10931 Persist_free(this_ptr_conv);
10934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
10935 LDKu8slice ser_ref;
10936 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10937 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10938 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
10939 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10940 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10942 return (long)ret_conv;
10945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10946 LDKOutPoint this_obj_conv;
10947 this_obj_conv.inner = (void*)(this_obj & (~1));
10948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10949 OutPoint_free(this_obj_conv);
10952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10953 LDKOutPoint this_ptr_conv;
10954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10955 this_ptr_conv.is_owned = false;
10956 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
10961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10962 LDKOutPoint this_ptr_conv;
10963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10964 this_ptr_conv.is_owned = false;
10965 LDKThirtyTwoBytes val_ref;
10966 CHECK((*env)->GetArrayLength(env, val) == 32);
10967 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10968 OutPoint_set_txid(&this_ptr_conv, val_ref);
10971 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10972 LDKOutPoint this_ptr_conv;
10973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10974 this_ptr_conv.is_owned = false;
10975 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10980 LDKOutPoint this_ptr_conv;
10981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10982 this_ptr_conv.is_owned = false;
10983 OutPoint_set_index(&this_ptr_conv, val);
10986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
10987 LDKThirtyTwoBytes txid_arg_ref;
10988 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
10989 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
10990 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10993 long ret_ref = (long)ret_var.inner;
10994 if (ret_var.is_owned) {
11000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11001 LDKOutPoint orig_conv;
11002 orig_conv.inner = (void*)(orig & (~1));
11003 orig_conv.is_owned = false;
11004 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
11005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11007 long ret_ref = (long)ret_var.inner;
11008 if (ret_var.is_owned) {
11014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11015 LDKOutPoint this_arg_conv;
11016 this_arg_conv.inner = (void*)(this_arg & (~1));
11017 this_arg_conv.is_owned = false;
11018 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11019 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
11023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
11024 LDKOutPoint obj_conv;
11025 obj_conv.inner = (void*)(obj & (~1));
11026 obj_conv.is_owned = false;
11027 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
11028 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11029 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11030 CVec_u8Z_free(ret_var);
11034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11035 LDKu8slice ser_ref;
11036 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11037 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11038 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11039 *ret_conv = OutPoint_read(ser_ref);
11040 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11041 return (long)ret_conv;
11044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11045 LDKDelayedPaymentOutputDescriptor this_obj_conv;
11046 this_obj_conv.inner = (void*)(this_obj & (~1));
11047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11048 DelayedPaymentOutputDescriptor_free(this_obj_conv);
11051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11052 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11054 this_ptr_conv.is_owned = false;
11055 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11056 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11057 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11058 long ret_ref = (long)ret_var.inner;
11059 if (ret_var.is_owned) {
11065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11066 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11068 this_ptr_conv.is_owned = false;
11069 LDKOutPoint val_conv;
11070 val_conv.inner = (void*)(val & (~1));
11071 val_conv.is_owned = (val & 1) || (val == 0);
11072 val_conv = OutPoint_clone(&val_conv);
11073 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11077 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11079 this_ptr_conv.is_owned = false;
11080 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11081 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
11085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11086 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11088 this_ptr_conv.is_owned = false;
11089 LDKPublicKey val_ref;
11090 CHECK((*env)->GetArrayLength(env, val) == 33);
11091 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11092 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
11095 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
11096 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11098 this_ptr_conv.is_owned = false;
11099 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
11103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11104 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11106 this_ptr_conv.is_owned = false;
11107 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
11110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11111 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = false;
11114 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11116 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
11120 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11122 this_ptr_conv.is_owned = false;
11123 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
11128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11129 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11131 this_ptr_conv.is_owned = false;
11132 LDKPublicKey val_ref;
11133 CHECK((*env)->GetArrayLength(env, val) == 33);
11134 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11135 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
11138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11139 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11141 this_ptr_conv.is_owned = false;
11142 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11143 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11148 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11150 this_ptr_conv.is_owned = false;
11151 LDKThirtyTwoBytes val_ref;
11152 CHECK((*env)->GetArrayLength(env, val) == 32);
11153 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11154 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11158 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11160 this_ptr_conv.is_owned = false;
11161 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11166 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11168 this_ptr_conv.is_owned = false;
11169 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11172 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) {
11173 LDKOutPoint outpoint_arg_conv;
11174 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11175 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11176 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11177 LDKPublicKey per_commitment_point_arg_ref;
11178 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
11179 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11180 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11181 FREE((void*)output_arg);
11182 LDKPublicKey revocation_pubkey_arg_ref;
11183 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
11184 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
11185 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11186 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11187 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11188 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);
11189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11191 long ret_ref = (long)ret_var.inner;
11192 if (ret_var.is_owned) {
11198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11199 LDKDelayedPaymentOutputDescriptor orig_conv;
11200 orig_conv.inner = (void*)(orig & (~1));
11201 orig_conv.is_owned = false;
11202 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
11203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11205 long ret_ref = (long)ret_var.inner;
11206 if (ret_var.is_owned) {
11212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11213 LDKStaticPaymentOutputDescriptor this_obj_conv;
11214 this_obj_conv.inner = (void*)(this_obj & (~1));
11215 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11216 StaticPaymentOutputDescriptor_free(this_obj_conv);
11219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11220 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11222 this_ptr_conv.is_owned = false;
11223 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11226 long ret_ref = (long)ret_var.inner;
11227 if (ret_var.is_owned) {
11233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11234 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11236 this_ptr_conv.is_owned = false;
11237 LDKOutPoint val_conv;
11238 val_conv.inner = (void*)(val & (~1));
11239 val_conv.is_owned = (val & 1) || (val == 0);
11240 val_conv = OutPoint_clone(&val_conv);
11241 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11245 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11247 this_ptr_conv.is_owned = false;
11248 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11250 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11254 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11256 this_ptr_conv.is_owned = false;
11257 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11263 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11265 this_ptr_conv.is_owned = false;
11266 LDKThirtyTwoBytes val_ref;
11267 CHECK((*env)->GetArrayLength(env, val) == 32);
11268 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11269 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11273 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11275 this_ptr_conv.is_owned = false;
11276 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11281 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11283 this_ptr_conv.is_owned = false;
11284 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11287 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) {
11288 LDKOutPoint outpoint_arg_conv;
11289 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11290 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11291 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11292 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11293 FREE((void*)output_arg);
11294 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11295 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11296 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11297 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
11298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11300 long ret_ref = (long)ret_var.inner;
11301 if (ret_var.is_owned) {
11307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11308 LDKStaticPaymentOutputDescriptor orig_conv;
11309 orig_conv.inner = (void*)(orig & (~1));
11310 orig_conv.is_owned = false;
11311 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
11312 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11313 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11314 long ret_ref = (long)ret_var.inner;
11315 if (ret_var.is_owned) {
11321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11322 if ((this_ptr & 1) != 0) return;
11323 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
11324 FREE((void*)this_ptr);
11325 SpendableOutputDescriptor_free(this_ptr_conv);
11328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11329 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
11330 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
11331 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
11332 long ret_ref = (long)ret_copy;
11336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
11337 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
11338 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
11339 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11340 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11341 CVec_u8Z_free(ret_var);
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11346 LDKu8slice ser_ref;
11347 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11348 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11349 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11350 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
11351 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11352 return (long)ret_conv;
11355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11356 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
11357 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11358 *ret = Sign_clone(orig_conv);
11362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11363 if ((this_ptr & 1) != 0) return;
11364 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
11365 FREE((void*)this_ptr);
11366 Sign_free(this_ptr_conv);
11369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11370 if ((this_ptr & 1) != 0) return;
11371 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
11372 FREE((void*)this_ptr);
11373 KeysInterface_free(this_ptr_conv);
11376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11377 LDKInMemorySigner this_obj_conv;
11378 this_obj_conv.inner = (void*)(this_obj & (~1));
11379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11380 InMemorySigner_free(this_obj_conv);
11383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11384 LDKInMemorySigner this_ptr_conv;
11385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11386 this_ptr_conv.is_owned = false;
11387 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11388 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
11392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11393 LDKInMemorySigner this_ptr_conv;
11394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11395 this_ptr_conv.is_owned = false;
11396 LDKSecretKey val_ref;
11397 CHECK((*env)->GetArrayLength(env, val) == 32);
11398 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11399 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
11402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11403 LDKInMemorySigner this_ptr_conv;
11404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11405 this_ptr_conv.is_owned = false;
11406 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
11411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11412 LDKInMemorySigner this_ptr_conv;
11413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11414 this_ptr_conv.is_owned = false;
11415 LDKSecretKey val_ref;
11416 CHECK((*env)->GetArrayLength(env, val) == 32);
11417 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11418 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
11421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11422 LDKInMemorySigner this_ptr_conv;
11423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11424 this_ptr_conv.is_owned = false;
11425 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
11430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11431 LDKInMemorySigner this_ptr_conv;
11432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11433 this_ptr_conv.is_owned = false;
11434 LDKSecretKey val_ref;
11435 CHECK((*env)->GetArrayLength(env, val) == 32);
11436 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11437 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
11440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11441 LDKInMemorySigner this_ptr_conv;
11442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11443 this_ptr_conv.is_owned = false;
11444 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11445 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
11449 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) {
11450 LDKInMemorySigner this_ptr_conv;
11451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11452 this_ptr_conv.is_owned = false;
11453 LDKSecretKey val_ref;
11454 CHECK((*env)->GetArrayLength(env, val) == 32);
11455 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11456 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
11459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11460 LDKInMemorySigner this_ptr_conv;
11461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11462 this_ptr_conv.is_owned = false;
11463 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11464 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
11468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11469 LDKInMemorySigner this_ptr_conv;
11470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11471 this_ptr_conv.is_owned = false;
11472 LDKSecretKey val_ref;
11473 CHECK((*env)->GetArrayLength(env, val) == 32);
11474 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11475 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
11479 LDKInMemorySigner this_ptr_conv;
11480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11481 this_ptr_conv.is_owned = false;
11482 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11483 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
11487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11488 LDKInMemorySigner this_ptr_conv;
11489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11490 this_ptr_conv.is_owned = false;
11491 LDKThirtyTwoBytes val_ref;
11492 CHECK((*env)->GetArrayLength(env, val) == 32);
11493 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11494 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11498 LDKInMemorySigner orig_conv;
11499 orig_conv.inner = (void*)(orig & (~1));
11500 orig_conv.is_owned = false;
11501 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11502 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11503 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11504 long ret_ref = (long)ret_var.inner;
11505 if (ret_var.is_owned) {
11511 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) {
11512 LDKSecretKey funding_key_ref;
11513 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
11514 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
11515 LDKSecretKey revocation_base_key_ref;
11516 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
11517 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
11518 LDKSecretKey payment_key_ref;
11519 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
11520 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
11521 LDKSecretKey delayed_payment_base_key_ref;
11522 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
11523 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
11524 LDKSecretKey htlc_base_key_ref;
11525 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
11526 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
11527 LDKThirtyTwoBytes commitment_seed_ref;
11528 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
11529 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
11530 LDKThirtyTwoBytes channel_keys_id_ref;
11531 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
11532 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
11533 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);
11534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11536 long ret_ref = (long)ret_var.inner;
11537 if (ret_var.is_owned) {
11543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
11544 LDKInMemorySigner this_arg_conv;
11545 this_arg_conv.inner = (void*)(this_arg & (~1));
11546 this_arg_conv.is_owned = false;
11547 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11550 long ret_ref = (long)ret_var.inner;
11551 if (ret_var.is_owned) {
11557 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11558 LDKInMemorySigner this_arg_conv;
11559 this_arg_conv.inner = (void*)(this_arg & (~1));
11560 this_arg_conv.is_owned = false;
11561 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11565 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11566 LDKInMemorySigner this_arg_conv;
11567 this_arg_conv.inner = (void*)(this_arg & (~1));
11568 this_arg_conv.is_owned = false;
11569 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
11574 LDKInMemorySigner this_arg_conv;
11575 this_arg_conv.inner = (void*)(this_arg & (~1));
11576 this_arg_conv.is_owned = false;
11577 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
11582 LDKInMemorySigner this_arg_conv;
11583 this_arg_conv.inner = (void*)(this_arg & (~1));
11584 this_arg_conv.is_owned = false;
11585 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11588 long ret_ref = (long)ret_var.inner;
11589 if (ret_var.is_owned) {
11595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
11596 LDKInMemorySigner this_arg_conv;
11597 this_arg_conv.inner = (void*)(this_arg & (~1));
11598 this_arg_conv.is_owned = false;
11599 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11602 long ret_ref = (long)ret_var.inner;
11603 if (ret_var.is_owned) {
11609 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) {
11610 LDKInMemorySigner this_arg_conv;
11611 this_arg_conv.inner = (void*)(this_arg & (~1));
11612 this_arg_conv.is_owned = false;
11613 LDKTransaction spend_tx_ref;
11614 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11615 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11616 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11617 spend_tx_ref.data_is_owned = true;
11618 LDKStaticPaymentOutputDescriptor descriptor_conv;
11619 descriptor_conv.inner = (void*)(descriptor & (~1));
11620 descriptor_conv.is_owned = false;
11621 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11622 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11623 return (long)ret_conv;
11626 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) {
11627 LDKInMemorySigner this_arg_conv;
11628 this_arg_conv.inner = (void*)(this_arg & (~1));
11629 this_arg_conv.is_owned = false;
11630 LDKTransaction spend_tx_ref;
11631 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11632 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11633 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11634 spend_tx_ref.data_is_owned = true;
11635 LDKDelayedPaymentOutputDescriptor descriptor_conv;
11636 descriptor_conv.inner = (void*)(descriptor & (~1));
11637 descriptor_conv.is_owned = false;
11638 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11639 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11640 return (long)ret_conv;
11643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
11644 LDKInMemorySigner this_arg_conv;
11645 this_arg_conv.inner = (void*)(this_arg & (~1));
11646 this_arg_conv.is_owned = false;
11647 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11648 *ret = InMemorySigner_as_Sign(&this_arg_conv);
11652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
11653 LDKInMemorySigner obj_conv;
11654 obj_conv.inner = (void*)(obj & (~1));
11655 obj_conv.is_owned = false;
11656 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
11657 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11658 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11659 CVec_u8Z_free(ret_var);
11663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11664 LDKu8slice ser_ref;
11665 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11666 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11667 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11668 *ret_conv = InMemorySigner_read(ser_ref);
11669 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11670 return (long)ret_conv;
11673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11674 LDKKeysManager this_obj_conv;
11675 this_obj_conv.inner = (void*)(this_obj & (~1));
11676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11677 KeysManager_free(this_obj_conv);
11680 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) {
11681 unsigned char seed_arr[32];
11682 CHECK((*env)->GetArrayLength(env, seed) == 32);
11683 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
11684 unsigned char (*seed_ref)[32] = &seed_arr;
11685 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
11686 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11687 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11688 long ret_ref = (long)ret_var.inner;
11689 if (ret_var.is_owned) {
11695 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) {
11696 LDKKeysManager this_arg_conv;
11697 this_arg_conv.inner = (void*)(this_arg & (~1));
11698 this_arg_conv.is_owned = false;
11699 unsigned char params_arr[32];
11700 CHECK((*env)->GetArrayLength(env, params) == 32);
11701 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
11702 unsigned char (*params_ref)[32] = ¶ms_arr;
11703 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
11704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11706 long ret_ref = (long)ret_var.inner;
11707 if (ret_var.is_owned) {
11713 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) {
11714 LDKKeysManager this_arg_conv;
11715 this_arg_conv.inner = (void*)(this_arg & (~1));
11716 this_arg_conv.is_owned = false;
11717 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
11718 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
11719 if (descriptors_constr.datalen > 0)
11720 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11722 descriptors_constr.data = NULL;
11723 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
11724 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
11725 int64_t descriptors_conv_27 = descriptors_vals[b];
11726 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
11727 FREE((void*)descriptors_conv_27);
11728 descriptors_constr.data[b] = descriptors_conv_27_conv;
11730 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
11731 LDKCVec_TxOutZ outputs_constr;
11732 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
11733 if (outputs_constr.datalen > 0)
11734 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11736 outputs_constr.data = NULL;
11737 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
11738 for (size_t h = 0; h < outputs_constr.datalen; h++) {
11739 int64_t outputs_conv_7 = outputs_vals[h];
11740 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
11741 FREE((void*)outputs_conv_7);
11742 outputs_constr.data[h] = outputs_conv_7_conv;
11744 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
11745 LDKCVec_u8Z change_destination_script_ref;
11746 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
11747 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
11748 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
11749 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11750 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
11751 return (long)ret_conv;
11754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
11755 LDKKeysManager this_arg_conv;
11756 this_arg_conv.inner = (void*)(this_arg & (~1));
11757 this_arg_conv.is_owned = false;
11758 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
11759 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
11763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11764 LDKChannelManager this_obj_conv;
11765 this_obj_conv.inner = (void*)(this_obj & (~1));
11766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11767 ChannelManager_free(this_obj_conv);
11770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11771 LDKChainParameters this_obj_conv;
11772 this_obj_conv.inner = (void*)(this_obj & (~1));
11773 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11774 ChainParameters_free(this_obj_conv);
11777 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
11778 LDKChainParameters this_ptr_conv;
11779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11780 this_ptr_conv.is_owned = false;
11781 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
11785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
11786 LDKChainParameters this_ptr_conv;
11787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11788 this_ptr_conv.is_owned = false;
11789 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
11790 ChainParameters_set_network(&this_ptr_conv, val_conv);
11793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11794 LDKChainParameters this_ptr_conv;
11795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11796 this_ptr_conv.is_owned = false;
11797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChainParameters_get_latest_hash(&this_ptr_conv));
11802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11803 LDKChainParameters this_ptr_conv;
11804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11805 this_ptr_conv.is_owned = false;
11806 LDKThirtyTwoBytes val_ref;
11807 CHECK((*env)->GetArrayLength(env, val) == 32);
11808 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11809 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
11812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
11813 LDKChainParameters this_ptr_conv;
11814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11815 this_ptr_conv.is_owned = false;
11816 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
11820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11821 LDKChainParameters this_ptr_conv;
11822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11823 this_ptr_conv.is_owned = false;
11824 ChainParameters_set_latest_height(&this_ptr_conv, val);
11827 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) {
11828 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
11829 LDKThirtyTwoBytes latest_hash_arg_ref;
11830 CHECK((*env)->GetArrayLength(env, latest_hash_arg) == 32);
11831 (*env)->GetByteArrayRegion(env, latest_hash_arg, 0, 32, latest_hash_arg_ref.data);
11832 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
11833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11835 long ret_ref = (long)ret_var.inner;
11836 if (ret_var.is_owned) {
11842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11843 LDKChannelDetails this_obj_conv;
11844 this_obj_conv.inner = (void*)(this_obj & (~1));
11845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11846 ChannelDetails_free(this_obj_conv);
11849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11850 LDKChannelDetails this_ptr_conv;
11851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11852 this_ptr_conv.is_owned = false;
11853 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11854 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
11858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11859 LDKChannelDetails this_ptr_conv;
11860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11861 this_ptr_conv.is_owned = false;
11862 LDKThirtyTwoBytes val_ref;
11863 CHECK((*env)->GetArrayLength(env, val) == 32);
11864 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11865 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11869 LDKChannelDetails this_ptr_conv;
11870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11871 this_ptr_conv.is_owned = false;
11872 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
11877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11878 LDKChannelDetails this_ptr_conv;
11879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11880 this_ptr_conv.is_owned = false;
11881 LDKPublicKey val_ref;
11882 CHECK((*env)->GetArrayLength(env, val) == 33);
11883 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11884 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11888 LDKChannelDetails this_ptr_conv;
11889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11890 this_ptr_conv.is_owned = false;
11891 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11894 long ret_ref = (long)ret_var.inner;
11895 if (ret_var.is_owned) {
11901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11902 LDKChannelDetails this_ptr_conv;
11903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11904 this_ptr_conv.is_owned = false;
11905 LDKInitFeatures val_conv;
11906 val_conv.inner = (void*)(val & (~1));
11907 val_conv.is_owned = (val & 1) || (val == 0);
11908 val_conv = InitFeatures_clone(&val_conv);
11909 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11913 LDKChannelDetails this_ptr_conv;
11914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11915 this_ptr_conv.is_owned = false;
11916 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11921 LDKChannelDetails this_ptr_conv;
11922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11923 this_ptr_conv.is_owned = false;
11924 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11928 LDKChannelDetails this_ptr_conv;
11929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11930 this_ptr_conv.is_owned = false;
11931 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11936 LDKChannelDetails this_ptr_conv;
11937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11938 this_ptr_conv.is_owned = false;
11939 ChannelDetails_set_user_id(&this_ptr_conv, val);
11942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11943 LDKChannelDetails this_ptr_conv;
11944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11945 this_ptr_conv.is_owned = false;
11946 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
11950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11951 LDKChannelDetails this_ptr_conv;
11952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11953 this_ptr_conv.is_owned = false;
11954 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
11957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11958 LDKChannelDetails this_ptr_conv;
11959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11960 this_ptr_conv.is_owned = false;
11961 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
11965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(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 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
11972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
11973 LDKChannelDetails this_ptr_conv;
11974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11975 this_ptr_conv.is_owned = false;
11976 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
11980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
11981 LDKChannelDetails this_ptr_conv;
11982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11983 this_ptr_conv.is_owned = false;
11984 ChannelDetails_set_is_live(&this_ptr_conv, val);
11987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11988 LDKChannelDetails orig_conv;
11989 orig_conv.inner = (void*)(orig & (~1));
11990 orig_conv.is_owned = false;
11991 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
11992 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11993 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11994 long ret_ref = (long)ret_var.inner;
11995 if (ret_var.is_owned) {
12001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12002 if ((this_ptr & 1) != 0) return;
12003 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
12004 FREE((void*)this_ptr);
12005 PaymentSendFailure_free(this_ptr_conv);
12008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12009 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
12010 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
12011 *ret_copy = PaymentSendFailure_clone(orig_conv);
12012 long ret_ref = (long)ret_copy;
12016 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) {
12017 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
12018 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
12019 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12020 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
12022 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12023 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12025 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12027 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12028 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12029 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12030 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12032 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12033 if (logger_conv.free == LDKLogger_JCalls_free) {
12034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12035 LDKLogger_JCalls_clone(logger_conv.this_arg);
12037 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12038 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12040 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12042 LDKUserConfig config_conv;
12043 config_conv.inner = (void*)(config & (~1));
12044 config_conv.is_owned = (config & 1) || (config == 0);
12045 config_conv = UserConfig_clone(&config_conv);
12046 LDKChainParameters params_conv;
12047 params_conv.inner = (void*)(params & (~1));
12048 params_conv.is_owned = (params & 1) || (params == 0);
12049 // Warning: we need a move here but no clone is available for LDKChainParameters
12050 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
12051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12053 long ret_ref = (long)ret_var.inner;
12054 if (ret_var.is_owned) {
12060 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) {
12061 LDKChannelManager this_arg_conv;
12062 this_arg_conv.inner = (void*)(this_arg & (~1));
12063 this_arg_conv.is_owned = false;
12064 LDKPublicKey their_network_key_ref;
12065 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
12066 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
12067 LDKUserConfig override_config_conv;
12068 override_config_conv.inner = (void*)(override_config & (~1));
12069 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
12070 override_config_conv = UserConfig_clone(&override_config_conv);
12071 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12072 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
12073 return (long)ret_conv;
12076 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12077 LDKChannelManager this_arg_conv;
12078 this_arg_conv.inner = (void*)(this_arg & (~1));
12079 this_arg_conv.is_owned = false;
12080 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
12081 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12082 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12083 for (size_t q = 0; q < ret_var.datalen; q++) {
12084 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12085 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12086 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12087 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12088 if (ret_conv_16_var.is_owned) {
12089 ret_conv_16_ref |= 1;
12091 ret_arr_ptr[q] = ret_conv_16_ref;
12093 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12094 FREE(ret_var.data);
12098 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12099 LDKChannelManager this_arg_conv;
12100 this_arg_conv.inner = (void*)(this_arg & (~1));
12101 this_arg_conv.is_owned = false;
12102 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
12103 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12104 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12105 for (size_t q = 0; q < ret_var.datalen; q++) {
12106 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12107 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12108 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12109 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12110 if (ret_conv_16_var.is_owned) {
12111 ret_conv_16_ref |= 1;
12113 ret_arr_ptr[q] = ret_conv_16_ref;
12115 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12116 FREE(ret_var.data);
12120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
12121 LDKChannelManager this_arg_conv;
12122 this_arg_conv.inner = (void*)(this_arg & (~1));
12123 this_arg_conv.is_owned = false;
12124 unsigned char channel_id_arr[32];
12125 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12126 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12127 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12128 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12129 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
12130 return (long)ret_conv;
12133 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) {
12134 LDKChannelManager this_arg_conv;
12135 this_arg_conv.inner = (void*)(this_arg & (~1));
12136 this_arg_conv.is_owned = false;
12137 unsigned char channel_id_arr[32];
12138 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12139 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12140 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12141 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12142 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
12143 return (long)ret_conv;
12146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12147 LDKChannelManager this_arg_conv;
12148 this_arg_conv.inner = (void*)(this_arg & (~1));
12149 this_arg_conv.is_owned = false;
12150 ChannelManager_force_close_all_channels(&this_arg_conv);
12153 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) {
12154 LDKChannelManager this_arg_conv;
12155 this_arg_conv.inner = (void*)(this_arg & (~1));
12156 this_arg_conv.is_owned = false;
12157 LDKRoute route_conv;
12158 route_conv.inner = (void*)(route & (~1));
12159 route_conv.is_owned = false;
12160 LDKThirtyTwoBytes payment_hash_ref;
12161 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12162 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
12163 LDKThirtyTwoBytes payment_secret_ref;
12164 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12165 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12166 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12167 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
12168 return (long)ret_conv;
12171 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) {
12172 LDKChannelManager this_arg_conv;
12173 this_arg_conv.inner = (void*)(this_arg & (~1));
12174 this_arg_conv.is_owned = false;
12175 unsigned char temporary_channel_id_arr[32];
12176 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
12177 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
12178 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
12179 LDKOutPoint funding_txo_conv;
12180 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12181 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
12182 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
12183 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
12186 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) {
12187 LDKChannelManager this_arg_conv;
12188 this_arg_conv.inner = (void*)(this_arg & (~1));
12189 this_arg_conv.is_owned = false;
12190 LDKThreeBytes rgb_ref;
12191 CHECK((*env)->GetArrayLength(env, rgb) == 3);
12192 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
12193 LDKThirtyTwoBytes alias_ref;
12194 CHECK((*env)->GetArrayLength(env, alias) == 32);
12195 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
12196 LDKCVec_NetAddressZ addresses_constr;
12197 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
12198 if (addresses_constr.datalen > 0)
12199 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12201 addresses_constr.data = NULL;
12202 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
12203 for (size_t m = 0; m < addresses_constr.datalen; m++) {
12204 int64_t addresses_conv_12 = addresses_vals[m];
12205 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
12206 FREE((void*)addresses_conv_12);
12207 addresses_constr.data[m] = addresses_conv_12_conv;
12209 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
12210 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
12213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
12214 LDKChannelManager this_arg_conv;
12215 this_arg_conv.inner = (void*)(this_arg & (~1));
12216 this_arg_conv.is_owned = false;
12217 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
12220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
12221 LDKChannelManager this_arg_conv;
12222 this_arg_conv.inner = (void*)(this_arg & (~1));
12223 this_arg_conv.is_owned = false;
12224 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
12227 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) {
12228 LDKChannelManager this_arg_conv;
12229 this_arg_conv.inner = (void*)(this_arg & (~1));
12230 this_arg_conv.is_owned = false;
12231 unsigned char payment_hash_arr[32];
12232 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12233 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
12234 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
12235 LDKThirtyTwoBytes payment_secret_ref;
12236 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12237 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12238 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
12242 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) {
12243 LDKChannelManager this_arg_conv;
12244 this_arg_conv.inner = (void*)(this_arg & (~1));
12245 this_arg_conv.is_owned = false;
12246 LDKThirtyTwoBytes payment_preimage_ref;
12247 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
12248 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
12249 LDKThirtyTwoBytes payment_secret_ref;
12250 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12251 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12252 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
12256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
12257 LDKChannelManager this_arg_conv;
12258 this_arg_conv.inner = (void*)(this_arg & (~1));
12259 this_arg_conv.is_owned = false;
12260 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12261 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
12265 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) {
12266 LDKChannelManager this_arg_conv;
12267 this_arg_conv.inner = (void*)(this_arg & (~1));
12268 this_arg_conv.is_owned = false;
12269 LDKOutPoint funding_txo_conv;
12270 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12271 funding_txo_conv.is_owned = false;
12272 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
12275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12276 LDKChannelManager this_arg_conv;
12277 this_arg_conv.inner = (void*)(this_arg & (~1));
12278 this_arg_conv.is_owned = false;
12279 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12280 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
12284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(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 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12289 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
12293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
12294 LDKChannelManager this_arg_conv;
12295 this_arg_conv.inner = (void*)(this_arg & (~1));
12296 this_arg_conv.is_owned = false;
12297 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12298 *ret = ChannelManager_as_Listen(&this_arg_conv);
12302 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) {
12303 LDKChannelManager this_arg_conv;
12304 this_arg_conv.inner = (void*)(this_arg & (~1));
12305 this_arg_conv.is_owned = false;
12306 unsigned char header_arr[80];
12307 CHECK((*env)->GetArrayLength(env, header) == 80);
12308 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12309 unsigned char (*header_ref)[80] = &header_arr;
12310 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12311 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12312 if (txdata_constr.datalen > 0)
12313 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12315 txdata_constr.data = NULL;
12316 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12317 for (size_t y = 0; y < txdata_constr.datalen; y++) {
12318 int64_t txdata_conv_24 = txdata_vals[y];
12319 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
12320 FREE((void*)txdata_conv_24);
12321 txdata_constr.data[y] = txdata_conv_24_conv;
12323 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12324 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
12327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
12328 LDKChannelManager this_arg_conv;
12329 this_arg_conv.inner = (void*)(this_arg & (~1));
12330 this_arg_conv.is_owned = false;
12331 unsigned char header_arr[80];
12332 CHECK((*env)->GetArrayLength(env, header) == 80);
12333 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12334 unsigned char (*header_ref)[80] = &header_arr;
12335 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
12338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
12339 LDKChannelManager this_arg_conv;
12340 this_arg_conv.inner = (void*)(this_arg & (~1));
12341 this_arg_conv.is_owned = false;
12342 ChannelManager_await_persistable_update(&this_arg_conv);
12345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
12346 LDKChannelManager this_arg_conv;
12347 this_arg_conv.inner = (void*)(this_arg & (~1));
12348 this_arg_conv.is_owned = false;
12349 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12350 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
12354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
12355 LDKChannelManager obj_conv;
12356 obj_conv.inner = (void*)(obj & (~1));
12357 obj_conv.is_owned = false;
12358 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
12359 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12360 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12361 CVec_u8Z_free(ret_var);
12365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12366 LDKChannelManagerReadArgs this_obj_conv;
12367 this_obj_conv.inner = (void*)(this_obj & (~1));
12368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12369 ChannelManagerReadArgs_free(this_obj_conv);
12372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
12373 LDKChannelManagerReadArgs this_ptr_conv;
12374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12375 this_ptr_conv.is_owned = false;
12376 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12381 LDKChannelManagerReadArgs this_ptr_conv;
12382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12383 this_ptr_conv.is_owned = false;
12384 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12385 if (val_conv.free == LDKKeysInterface_JCalls_free) {
12386 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12387 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
12389 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
12393 LDKChannelManagerReadArgs this_ptr_conv;
12394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12395 this_ptr_conv.is_owned = false;
12396 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12401 LDKChannelManagerReadArgs this_ptr_conv;
12402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12403 this_ptr_conv.is_owned = false;
12404 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12405 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
12406 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12407 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
12409 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
12413 LDKChannelManagerReadArgs this_ptr_conv;
12414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12415 this_ptr_conv.is_owned = false;
12416 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12421 LDKChannelManagerReadArgs this_ptr_conv;
12422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12423 this_ptr_conv.is_owned = false;
12424 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12425 if (val_conv.free == LDKWatch_JCalls_free) {
12426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12427 LDKWatch_JCalls_clone(val_conv.this_arg);
12429 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
12433 LDKChannelManagerReadArgs this_ptr_conv;
12434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12435 this_ptr_conv.is_owned = false;
12436 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12441 LDKChannelManagerReadArgs this_ptr_conv;
12442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12443 this_ptr_conv.is_owned = false;
12444 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12445 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
12446 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12447 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
12449 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
12453 LDKChannelManagerReadArgs this_ptr_conv;
12454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12455 this_ptr_conv.is_owned = false;
12456 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12461 LDKChannelManagerReadArgs this_ptr_conv;
12462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12463 this_ptr_conv.is_owned = false;
12464 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12465 if (val_conv.free == LDKLogger_JCalls_free) {
12466 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12467 LDKLogger_JCalls_clone(val_conv.this_arg);
12469 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
12473 LDKChannelManagerReadArgs this_ptr_conv;
12474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12475 this_ptr_conv.is_owned = false;
12476 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12479 long ret_ref = (long)ret_var.inner;
12480 if (ret_var.is_owned) {
12486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12487 LDKChannelManagerReadArgs this_ptr_conv;
12488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12489 this_ptr_conv.is_owned = false;
12490 LDKUserConfig val_conv;
12491 val_conv.inner = (void*)(val & (~1));
12492 val_conv.is_owned = (val & 1) || (val == 0);
12493 val_conv = UserConfig_clone(&val_conv);
12494 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12497 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) {
12498 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12499 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12500 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12501 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12503 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12504 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
12505 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12506 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
12508 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12509 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12510 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12511 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12513 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12514 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12515 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12516 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12518 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12519 if (logger_conv.free == LDKLogger_JCalls_free) {
12520 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12521 LDKLogger_JCalls_clone(logger_conv.this_arg);
12523 LDKUserConfig default_config_conv;
12524 default_config_conv.inner = (void*)(default_config & (~1));
12525 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12526 default_config_conv = UserConfig_clone(&default_config_conv);
12527 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12528 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
12529 if (channel_monitors_constr.datalen > 0)
12530 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12532 channel_monitors_constr.data = NULL;
12533 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
12534 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12535 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
12536 LDKChannelMonitor channel_monitors_conv_16_conv;
12537 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12538 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12539 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12541 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
12542 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);
12543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12545 long ret_ref = (long)ret_var.inner;
12546 if (ret_var.is_owned) {
12552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
12553 LDKu8slice ser_ref;
12554 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
12555 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
12556 LDKChannelManagerReadArgs arg_conv;
12557 arg_conv.inner = (void*)(arg & (~1));
12558 arg_conv.is_owned = (arg & 1) || (arg == 0);
12559 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12560 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12561 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12562 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
12563 return (long)ret_conv;
12566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12567 LDKDecodeError this_obj_conv;
12568 this_obj_conv.inner = (void*)(this_obj & (~1));
12569 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12570 DecodeError_free(this_obj_conv);
12573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12574 LDKDecodeError orig_conv;
12575 orig_conv.inner = (void*)(orig & (~1));
12576 orig_conv.is_owned = false;
12577 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12578 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12579 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12580 long ret_ref = (long)ret_var.inner;
12581 if (ret_var.is_owned) {
12587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12588 LDKInit this_obj_conv;
12589 this_obj_conv.inner = (void*)(this_obj & (~1));
12590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12591 Init_free(this_obj_conv);
12594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
12595 LDKInit this_ptr_conv;
12596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12597 this_ptr_conv.is_owned = false;
12598 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12601 long ret_ref = (long)ret_var.inner;
12602 if (ret_var.is_owned) {
12608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12609 LDKInit this_ptr_conv;
12610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12611 this_ptr_conv.is_owned = false;
12612 LDKInitFeatures val_conv;
12613 val_conv.inner = (void*)(val & (~1));
12614 val_conv.is_owned = (val & 1) || (val == 0);
12615 val_conv = InitFeatures_clone(&val_conv);
12616 Init_set_features(&this_ptr_conv, val_conv);
12619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
12620 LDKInitFeatures features_arg_conv;
12621 features_arg_conv.inner = (void*)(features_arg & (~1));
12622 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12623 features_arg_conv = InitFeatures_clone(&features_arg_conv);
12624 LDKInit ret_var = Init_new(features_arg_conv);
12625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12627 long ret_ref = (long)ret_var.inner;
12628 if (ret_var.is_owned) {
12634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12636 orig_conv.inner = (void*)(orig & (~1));
12637 orig_conv.is_owned = false;
12638 LDKInit ret_var = Init_clone(&orig_conv);
12639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12641 long ret_ref = (long)ret_var.inner;
12642 if (ret_var.is_owned) {
12648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12649 LDKErrorMessage this_obj_conv;
12650 this_obj_conv.inner = (void*)(this_obj & (~1));
12651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12652 ErrorMessage_free(this_obj_conv);
12655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12656 LDKErrorMessage this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = false;
12659 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
12664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12665 LDKErrorMessage this_ptr_conv;
12666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12667 this_ptr_conv.is_owned = false;
12668 LDKThirtyTwoBytes val_ref;
12669 CHECK((*env)->GetArrayLength(env, val) == 32);
12670 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12671 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
12674 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
12675 LDKErrorMessage this_ptr_conv;
12676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12677 this_ptr_conv.is_owned = false;
12678 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
12679 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12684 LDKErrorMessage this_ptr_conv;
12685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12686 this_ptr_conv.is_owned = false;
12687 LDKCVec_u8Z val_ref;
12688 val_ref.datalen = (*env)->GetArrayLength(env, val);
12689 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12690 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12691 ErrorMessage_set_data(&this_ptr_conv, val_ref);
12694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
12695 LDKThirtyTwoBytes channel_id_arg_ref;
12696 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12697 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12698 LDKCVec_u8Z data_arg_ref;
12699 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
12700 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12701 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
12702 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
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 int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12713 LDKErrorMessage orig_conv;
12714 orig_conv.inner = (void*)(orig & (~1));
12715 orig_conv.is_owned = false;
12716 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
12717 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12718 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12719 long ret_ref = (long)ret_var.inner;
12720 if (ret_var.is_owned) {
12726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12727 LDKPing this_obj_conv;
12728 this_obj_conv.inner = (void*)(this_obj & (~1));
12729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12730 Ping_free(this_obj_conv);
12733 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12734 LDKPing this_ptr_conv;
12735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12736 this_ptr_conv.is_owned = false;
12737 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
12741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12742 LDKPing this_ptr_conv;
12743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12744 this_ptr_conv.is_owned = false;
12745 Ping_set_ponglen(&this_ptr_conv, val);
12748 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12749 LDKPing this_ptr_conv;
12750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12751 this_ptr_conv.is_owned = false;
12752 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
12756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12757 LDKPing this_ptr_conv;
12758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12759 this_ptr_conv.is_owned = false;
12760 Ping_set_byteslen(&this_ptr_conv, val);
12763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
12764 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
12765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12767 long ret_ref = (long)ret_var.inner;
12768 if (ret_var.is_owned) {
12774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12776 orig_conv.inner = (void*)(orig & (~1));
12777 orig_conv.is_owned = false;
12778 LDKPing ret_var = Ping_clone(&orig_conv);
12779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12781 long ret_ref = (long)ret_var.inner;
12782 if (ret_var.is_owned) {
12788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12789 LDKPong this_obj_conv;
12790 this_obj_conv.inner = (void*)(this_obj & (~1));
12791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12792 Pong_free(this_obj_conv);
12795 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
12796 LDKPong this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = false;
12799 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
12803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12804 LDKPong this_ptr_conv;
12805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12806 this_ptr_conv.is_owned = false;
12807 Pong_set_byteslen(&this_ptr_conv, val);
12810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
12811 LDKPong ret_var = Pong_new(byteslen_arg);
12812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12814 long ret_ref = (long)ret_var.inner;
12815 if (ret_var.is_owned) {
12821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12823 orig_conv.inner = (void*)(orig & (~1));
12824 orig_conv.is_owned = false;
12825 LDKPong ret_var = Pong_clone(&orig_conv);
12826 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12827 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12828 long ret_ref = (long)ret_var.inner;
12829 if (ret_var.is_owned) {
12835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12836 LDKOpenChannel this_obj_conv;
12837 this_obj_conv.inner = (void*)(this_obj & (~1));
12838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12839 OpenChannel_free(this_obj_conv);
12842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12843 LDKOpenChannel this_ptr_conv;
12844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12845 this_ptr_conv.is_owned = false;
12846 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
12851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12852 LDKOpenChannel this_ptr_conv;
12853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12854 this_ptr_conv.is_owned = false;
12855 LDKThirtyTwoBytes val_ref;
12856 CHECK((*env)->GetArrayLength(env, val) == 32);
12857 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12858 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
12861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12862 LDKOpenChannel this_ptr_conv;
12863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12864 this_ptr_conv.is_owned = false;
12865 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
12870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12871 LDKOpenChannel this_ptr_conv;
12872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12873 this_ptr_conv.is_owned = false;
12874 LDKThirtyTwoBytes val_ref;
12875 CHECK((*env)->GetArrayLength(env, val) == 32);
12876 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12877 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12881 LDKOpenChannel this_ptr_conv;
12882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12883 this_ptr_conv.is_owned = false;
12884 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12889 LDKOpenChannel this_ptr_conv;
12890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12891 this_ptr_conv.is_owned = false;
12892 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12896 LDKOpenChannel this_ptr_conv;
12897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12898 this_ptr_conv.is_owned = false;
12899 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12904 LDKOpenChannel this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = false;
12907 OpenChannel_set_push_msat(&this_ptr_conv, val);
12910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12911 LDKOpenChannel this_ptr_conv;
12912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12913 this_ptr_conv.is_owned = false;
12914 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12919 LDKOpenChannel this_ptr_conv;
12920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12921 this_ptr_conv.is_owned = false;
12922 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12925 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) {
12926 LDKOpenChannel this_ptr_conv;
12927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12928 this_ptr_conv.is_owned = false;
12929 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12933 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) {
12934 LDKOpenChannel this_ptr_conv;
12935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12936 this_ptr_conv.is_owned = false;
12937 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12941 LDKOpenChannel this_ptr_conv;
12942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12943 this_ptr_conv.is_owned = false;
12944 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12949 LDKOpenChannel this_ptr_conv;
12950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12951 this_ptr_conv.is_owned = false;
12952 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12956 LDKOpenChannel this_ptr_conv;
12957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12958 this_ptr_conv.is_owned = false;
12959 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
12963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12964 LDKOpenChannel this_ptr_conv;
12965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12966 this_ptr_conv.is_owned = false;
12967 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12970 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
12971 LDKOpenChannel this_ptr_conv;
12972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12973 this_ptr_conv.is_owned = false;
12974 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
12978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12979 LDKOpenChannel this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = false;
12982 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
12985 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
12986 LDKOpenChannel this_ptr_conv;
12987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12988 this_ptr_conv.is_owned = false;
12989 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
12993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12994 LDKOpenChannel this_ptr_conv;
12995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12996 this_ptr_conv.is_owned = false;
12997 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
13000 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13001 LDKOpenChannel this_ptr_conv;
13002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13003 this_ptr_conv.is_owned = false;
13004 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
13008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13009 LDKOpenChannel this_ptr_conv;
13010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13011 this_ptr_conv.is_owned = false;
13012 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13016 LDKOpenChannel this_ptr_conv;
13017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13018 this_ptr_conv.is_owned = false;
13019 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13025 LDKOpenChannel this_ptr_conv;
13026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13027 this_ptr_conv.is_owned = false;
13028 LDKPublicKey val_ref;
13029 CHECK((*env)->GetArrayLength(env, val) == 33);
13030 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13031 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13039 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13044 LDKOpenChannel this_ptr_conv;
13045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13046 this_ptr_conv.is_owned = false;
13047 LDKPublicKey val_ref;
13048 CHECK((*env)->GetArrayLength(env, val) == 33);
13049 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13050 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13054 LDKOpenChannel this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = false;
13057 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13058 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
13062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13063 LDKOpenChannel this_ptr_conv;
13064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13065 this_ptr_conv.is_owned = false;
13066 LDKPublicKey val_ref;
13067 CHECK((*env)->GetArrayLength(env, val) == 33);
13068 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13069 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
13072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13073 LDKOpenChannel this_ptr_conv;
13074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13075 this_ptr_conv.is_owned = false;
13076 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13082 LDKOpenChannel this_ptr_conv;
13083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13084 this_ptr_conv.is_owned = false;
13085 LDKPublicKey val_ref;
13086 CHECK((*env)->GetArrayLength(env, val) == 33);
13087 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13088 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13092 LDKOpenChannel this_ptr_conv;
13093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13094 this_ptr_conv.is_owned = false;
13095 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13096 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13101 LDKOpenChannel this_ptr_conv;
13102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13103 this_ptr_conv.is_owned = false;
13104 LDKPublicKey val_ref;
13105 CHECK((*env)->GetArrayLength(env, val) == 33);
13106 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13107 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13111 LDKOpenChannel this_ptr_conv;
13112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13113 this_ptr_conv.is_owned = false;
13114 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13115 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13119 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) {
13120 LDKOpenChannel this_ptr_conv;
13121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13122 this_ptr_conv.is_owned = false;
13123 LDKPublicKey val_ref;
13124 CHECK((*env)->GetArrayLength(env, val) == 33);
13125 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13126 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13129 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
13130 LDKOpenChannel this_ptr_conv;
13131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13132 this_ptr_conv.is_owned = false;
13133 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
13137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
13138 LDKOpenChannel this_ptr_conv;
13139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13140 this_ptr_conv.is_owned = false;
13141 OpenChannel_set_channel_flags(&this_ptr_conv, val);
13144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13145 LDKOpenChannel orig_conv;
13146 orig_conv.inner = (void*)(orig & (~1));
13147 orig_conv.is_owned = false;
13148 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
13149 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13150 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13151 long ret_ref = (long)ret_var.inner;
13152 if (ret_var.is_owned) {
13158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13159 LDKAcceptChannel this_obj_conv;
13160 this_obj_conv.inner = (void*)(this_obj & (~1));
13161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13162 AcceptChannel_free(this_obj_conv);
13165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13166 LDKAcceptChannel this_ptr_conv;
13167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13168 this_ptr_conv.is_owned = false;
13169 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13170 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
13174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13175 LDKAcceptChannel this_ptr_conv;
13176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13177 this_ptr_conv.is_owned = false;
13178 LDKThirtyTwoBytes val_ref;
13179 CHECK((*env)->GetArrayLength(env, val) == 32);
13180 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13181 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
13184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13185 LDKAcceptChannel this_ptr_conv;
13186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13187 this_ptr_conv.is_owned = false;
13188 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
13192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13193 LDKAcceptChannel this_ptr_conv;
13194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13195 this_ptr_conv.is_owned = false;
13196 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
13199 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) {
13200 LDKAcceptChannel this_ptr_conv;
13201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13202 this_ptr_conv.is_owned = false;
13203 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
13207 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) {
13208 LDKAcceptChannel this_ptr_conv;
13209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13210 this_ptr_conv.is_owned = false;
13211 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13215 LDKAcceptChannel this_ptr_conv;
13216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13217 this_ptr_conv.is_owned = false;
13218 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
13222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13223 LDKAcceptChannel this_ptr_conv;
13224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13225 this_ptr_conv.is_owned = false;
13226 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
13229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(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 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
13237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13238 LDKAcceptChannel this_ptr_conv;
13239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13240 this_ptr_conv.is_owned = false;
13241 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
13244 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13245 LDKAcceptChannel this_ptr_conv;
13246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13247 this_ptr_conv.is_owned = false;
13248 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
13252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13253 LDKAcceptChannel this_ptr_conv;
13254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13255 this_ptr_conv.is_owned = false;
13256 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
13259 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13260 LDKAcceptChannel this_ptr_conv;
13261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13262 this_ptr_conv.is_owned = false;
13263 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
13267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13268 LDKAcceptChannel this_ptr_conv;
13269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13270 this_ptr_conv.is_owned = false;
13271 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
13274 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13275 LDKAcceptChannel this_ptr_conv;
13276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13277 this_ptr_conv.is_owned = false;
13278 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
13282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13283 LDKAcceptChannel this_ptr_conv;
13284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13285 this_ptr_conv.is_owned = false;
13286 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13290 LDKAcceptChannel this_ptr_conv;
13291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13292 this_ptr_conv.is_owned = false;
13293 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13294 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13299 LDKAcceptChannel this_ptr_conv;
13300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13301 this_ptr_conv.is_owned = false;
13302 LDKPublicKey val_ref;
13303 CHECK((*env)->GetArrayLength(env, val) == 33);
13304 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13305 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13313 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13318 LDKAcceptChannel this_ptr_conv;
13319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13320 this_ptr_conv.is_owned = false;
13321 LDKPublicKey val_ref;
13322 CHECK((*env)->GetArrayLength(env, val) == 33);
13323 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13324 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13328 LDKAcceptChannel this_ptr_conv;
13329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13330 this_ptr_conv.is_owned = false;
13331 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13332 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
13336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13337 LDKAcceptChannel this_ptr_conv;
13338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13339 this_ptr_conv.is_owned = false;
13340 LDKPublicKey val_ref;
13341 CHECK((*env)->GetArrayLength(env, val) == 33);
13342 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13343 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
13346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13347 LDKAcceptChannel this_ptr_conv;
13348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13349 this_ptr_conv.is_owned = false;
13350 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13351 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13356 LDKAcceptChannel this_ptr_conv;
13357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13358 this_ptr_conv.is_owned = false;
13359 LDKPublicKey val_ref;
13360 CHECK((*env)->GetArrayLength(env, val) == 33);
13361 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13362 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13366 LDKAcceptChannel this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = false;
13369 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13370 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13375 LDKAcceptChannel this_ptr_conv;
13376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13377 this_ptr_conv.is_owned = false;
13378 LDKPublicKey val_ref;
13379 CHECK((*env)->GetArrayLength(env, val) == 33);
13380 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13381 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13385 LDKAcceptChannel this_ptr_conv;
13386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13387 this_ptr_conv.is_owned = false;
13388 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13389 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13393 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) {
13394 LDKAcceptChannel this_ptr_conv;
13395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13396 this_ptr_conv.is_owned = false;
13397 LDKPublicKey val_ref;
13398 CHECK((*env)->GetArrayLength(env, val) == 33);
13399 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13400 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13404 LDKAcceptChannel orig_conv;
13405 orig_conv.inner = (void*)(orig & (~1));
13406 orig_conv.is_owned = false;
13407 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13410 long ret_ref = (long)ret_var.inner;
13411 if (ret_var.is_owned) {
13417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13418 LDKFundingCreated this_obj_conv;
13419 this_obj_conv.inner = (void*)(this_obj & (~1));
13420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13421 FundingCreated_free(this_obj_conv);
13424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13425 LDKFundingCreated this_ptr_conv;
13426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13427 this_ptr_conv.is_owned = false;
13428 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13429 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
13433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13434 LDKFundingCreated this_ptr_conv;
13435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13436 this_ptr_conv.is_owned = false;
13437 LDKThirtyTwoBytes val_ref;
13438 CHECK((*env)->GetArrayLength(env, val) == 32);
13439 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13440 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
13444 LDKFundingCreated this_ptr_conv;
13445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13446 this_ptr_conv.is_owned = false;
13447 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
13452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13453 LDKFundingCreated this_ptr_conv;
13454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13455 this_ptr_conv.is_owned = false;
13456 LDKThirtyTwoBytes val_ref;
13457 CHECK((*env)->GetArrayLength(env, val) == 32);
13458 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13459 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13462 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
13463 LDKFundingCreated this_ptr_conv;
13464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13465 this_ptr_conv.is_owned = false;
13466 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13471 LDKFundingCreated this_ptr_conv;
13472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13473 this_ptr_conv.is_owned = false;
13474 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13478 LDKFundingCreated this_ptr_conv;
13479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13480 this_ptr_conv.is_owned = false;
13481 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13482 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
13486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13487 LDKFundingCreated this_ptr_conv;
13488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13489 this_ptr_conv.is_owned = false;
13490 LDKSignature val_ref;
13491 CHECK((*env)->GetArrayLength(env, val) == 64);
13492 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13493 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13496 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) {
13497 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13498 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
13499 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
13500 LDKThirtyTwoBytes funding_txid_arg_ref;
13501 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
13502 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
13503 LDKSignature signature_arg_ref;
13504 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13505 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13506 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
13507 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13508 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13509 long ret_ref = (long)ret_var.inner;
13510 if (ret_var.is_owned) {
13516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13517 LDKFundingCreated orig_conv;
13518 orig_conv.inner = (void*)(orig & (~1));
13519 orig_conv.is_owned = false;
13520 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13521 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13522 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13523 long ret_ref = (long)ret_var.inner;
13524 if (ret_var.is_owned) {
13530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13531 LDKFundingSigned this_obj_conv;
13532 this_obj_conv.inner = (void*)(this_obj & (~1));
13533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13534 FundingSigned_free(this_obj_conv);
13537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13538 LDKFundingSigned this_ptr_conv;
13539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13540 this_ptr_conv.is_owned = false;
13541 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13542 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
13546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13547 LDKFundingSigned this_ptr_conv;
13548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13549 this_ptr_conv.is_owned = false;
13550 LDKThirtyTwoBytes val_ref;
13551 CHECK((*env)->GetArrayLength(env, val) == 32);
13552 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13553 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13557 LDKFundingSigned this_ptr_conv;
13558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13559 this_ptr_conv.is_owned = false;
13560 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13561 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
13565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13566 LDKFundingSigned this_ptr_conv;
13567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13568 this_ptr_conv.is_owned = false;
13569 LDKSignature val_ref;
13570 CHECK((*env)->GetArrayLength(env, val) == 64);
13571 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13572 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
13576 LDKThirtyTwoBytes channel_id_arg_ref;
13577 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13578 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13579 LDKSignature signature_arg_ref;
13580 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13581 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13582 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13585 long ret_ref = (long)ret_var.inner;
13586 if (ret_var.is_owned) {
13592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13593 LDKFundingSigned orig_conv;
13594 orig_conv.inner = (void*)(orig & (~1));
13595 orig_conv.is_owned = false;
13596 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13599 long ret_ref = (long)ret_var.inner;
13600 if (ret_var.is_owned) {
13606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13607 LDKFundingLocked this_obj_conv;
13608 this_obj_conv.inner = (void*)(this_obj & (~1));
13609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13610 FundingLocked_free(this_obj_conv);
13613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13614 LDKFundingLocked this_ptr_conv;
13615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13616 this_ptr_conv.is_owned = false;
13617 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
13622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13623 LDKFundingLocked this_ptr_conv;
13624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13625 this_ptr_conv.is_owned = false;
13626 LDKThirtyTwoBytes val_ref;
13627 CHECK((*env)->GetArrayLength(env, val) == 32);
13628 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13629 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
13632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13633 LDKFundingLocked this_ptr_conv;
13634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13635 this_ptr_conv.is_owned = false;
13636 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13637 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
13641 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) {
13642 LDKFundingLocked this_ptr_conv;
13643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13644 this_ptr_conv.is_owned = false;
13645 LDKPublicKey val_ref;
13646 CHECK((*env)->GetArrayLength(env, val) == 33);
13647 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13648 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13651 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) {
13652 LDKThirtyTwoBytes channel_id_arg_ref;
13653 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13654 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13655 LDKPublicKey next_per_commitment_point_arg_ref;
13656 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
13657 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
13658 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
13659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13661 long ret_ref = (long)ret_var.inner;
13662 if (ret_var.is_owned) {
13668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13669 LDKFundingLocked orig_conv;
13670 orig_conv.inner = (void*)(orig & (~1));
13671 orig_conv.is_owned = false;
13672 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
13673 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13674 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13675 long ret_ref = (long)ret_var.inner;
13676 if (ret_var.is_owned) {
13682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13683 LDKShutdown this_obj_conv;
13684 this_obj_conv.inner = (void*)(this_obj & (~1));
13685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13686 Shutdown_free(this_obj_conv);
13689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13690 LDKShutdown this_ptr_conv;
13691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13692 this_ptr_conv.is_owned = false;
13693 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13694 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
13698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13699 LDKShutdown this_ptr_conv;
13700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13701 this_ptr_conv.is_owned = false;
13702 LDKThirtyTwoBytes val_ref;
13703 CHECK((*env)->GetArrayLength(env, val) == 32);
13704 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13705 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
13708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13709 LDKShutdown this_ptr_conv;
13710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13711 this_ptr_conv.is_owned = false;
13712 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
13713 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13714 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13719 LDKShutdown this_ptr_conv;
13720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13721 this_ptr_conv.is_owned = false;
13722 LDKCVec_u8Z val_ref;
13723 val_ref.datalen = (*env)->GetArrayLength(env, val);
13724 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13725 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13726 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
13729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
13730 LDKThirtyTwoBytes channel_id_arg_ref;
13731 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13732 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13733 LDKCVec_u8Z scriptpubkey_arg_ref;
13734 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
13735 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13736 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
13737 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
13738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13740 long ret_ref = (long)ret_var.inner;
13741 if (ret_var.is_owned) {
13747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13748 LDKShutdown orig_conv;
13749 orig_conv.inner = (void*)(orig & (~1));
13750 orig_conv.is_owned = false;
13751 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
13752 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13753 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13754 long ret_ref = (long)ret_var.inner;
13755 if (ret_var.is_owned) {
13761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13762 LDKClosingSigned this_obj_conv;
13763 this_obj_conv.inner = (void*)(this_obj & (~1));
13764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13765 ClosingSigned_free(this_obj_conv);
13768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13769 LDKClosingSigned this_ptr_conv;
13770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13771 this_ptr_conv.is_owned = false;
13772 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13773 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
13777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13778 LDKClosingSigned this_ptr_conv;
13779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13780 this_ptr_conv.is_owned = false;
13781 LDKThirtyTwoBytes val_ref;
13782 CHECK((*env)->GetArrayLength(env, val) == 32);
13783 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13784 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
13787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13788 LDKClosingSigned this_ptr_conv;
13789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13790 this_ptr_conv.is_owned = false;
13791 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
13795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13796 LDKClosingSigned this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = false;
13799 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
13802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13803 LDKClosingSigned this_ptr_conv;
13804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13805 this_ptr_conv.is_owned = false;
13806 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13807 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
13811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13812 LDKClosingSigned this_ptr_conv;
13813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13814 this_ptr_conv.is_owned = false;
13815 LDKSignature val_ref;
13816 CHECK((*env)->GetArrayLength(env, val) == 64);
13817 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13818 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
13821 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) {
13822 LDKThirtyTwoBytes channel_id_arg_ref;
13823 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13824 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13825 LDKSignature signature_arg_ref;
13826 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13827 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13828 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
13829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13831 long ret_ref = (long)ret_var.inner;
13832 if (ret_var.is_owned) {
13838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13839 LDKClosingSigned orig_conv;
13840 orig_conv.inner = (void*)(orig & (~1));
13841 orig_conv.is_owned = false;
13842 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
13843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13845 long ret_ref = (long)ret_var.inner;
13846 if (ret_var.is_owned) {
13852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13853 LDKUpdateAddHTLC this_obj_conv;
13854 this_obj_conv.inner = (void*)(this_obj & (~1));
13855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13856 UpdateAddHTLC_free(this_obj_conv);
13859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13860 LDKUpdateAddHTLC this_ptr_conv;
13861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13862 this_ptr_conv.is_owned = false;
13863 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13864 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
13868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13869 LDKUpdateAddHTLC this_ptr_conv;
13870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13871 this_ptr_conv.is_owned = false;
13872 LDKThirtyTwoBytes val_ref;
13873 CHECK((*env)->GetArrayLength(env, val) == 32);
13874 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13875 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
13878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13879 LDKUpdateAddHTLC this_ptr_conv;
13880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13881 this_ptr_conv.is_owned = false;
13882 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13887 LDKUpdateAddHTLC this_ptr_conv;
13888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13889 this_ptr_conv.is_owned = false;
13890 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13894 LDKUpdateAddHTLC this_ptr_conv;
13895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13896 this_ptr_conv.is_owned = false;
13897 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13902 LDKUpdateAddHTLC this_ptr_conv;
13903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13904 this_ptr_conv.is_owned = false;
13905 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13909 LDKUpdateAddHTLC this_ptr_conv;
13910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13911 this_ptr_conv.is_owned = false;
13912 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13913 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
13917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13918 LDKUpdateAddHTLC this_ptr_conv;
13919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13920 this_ptr_conv.is_owned = false;
13921 LDKThirtyTwoBytes val_ref;
13922 CHECK((*env)->GetArrayLength(env, val) == 32);
13923 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13924 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13927 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
13928 LDKUpdateAddHTLC this_ptr_conv;
13929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13930 this_ptr_conv.is_owned = false;
13931 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13936 LDKUpdateAddHTLC this_ptr_conv;
13937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13938 this_ptr_conv.is_owned = false;
13939 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
13942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13943 LDKUpdateAddHTLC orig_conv;
13944 orig_conv.inner = (void*)(orig & (~1));
13945 orig_conv.is_owned = false;
13946 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
13947 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13948 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13949 long ret_ref = (long)ret_var.inner;
13950 if (ret_var.is_owned) {
13956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13957 LDKUpdateFulfillHTLC this_obj_conv;
13958 this_obj_conv.inner = (void*)(this_obj & (~1));
13959 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13960 UpdateFulfillHTLC_free(this_obj_conv);
13963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13964 LDKUpdateFulfillHTLC this_ptr_conv;
13965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13966 this_ptr_conv.is_owned = false;
13967 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13968 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
13972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13973 LDKUpdateFulfillHTLC this_ptr_conv;
13974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13975 this_ptr_conv.is_owned = false;
13976 LDKThirtyTwoBytes val_ref;
13977 CHECK((*env)->GetArrayLength(env, val) == 32);
13978 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13979 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
13982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13983 LDKUpdateFulfillHTLC this_ptr_conv;
13984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13985 this_ptr_conv.is_owned = false;
13986 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
13990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13991 LDKUpdateFulfillHTLC this_ptr_conv;
13992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13993 this_ptr_conv.is_owned = false;
13994 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
13997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
13998 LDKUpdateFulfillHTLC this_ptr_conv;
13999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14000 this_ptr_conv.is_owned = false;
14001 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
14006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14007 LDKUpdateFulfillHTLC this_ptr_conv;
14008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14009 this_ptr_conv.is_owned = false;
14010 LDKThirtyTwoBytes val_ref;
14011 CHECK((*env)->GetArrayLength(env, val) == 32);
14012 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14013 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
14016 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) {
14017 LDKThirtyTwoBytes channel_id_arg_ref;
14018 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14019 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14020 LDKThirtyTwoBytes payment_preimage_arg_ref;
14021 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
14022 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
14023 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
14024 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14025 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14026 long ret_ref = (long)ret_var.inner;
14027 if (ret_var.is_owned) {
14033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14034 LDKUpdateFulfillHTLC orig_conv;
14035 orig_conv.inner = (void*)(orig & (~1));
14036 orig_conv.is_owned = false;
14037 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
14038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14040 long ret_ref = (long)ret_var.inner;
14041 if (ret_var.is_owned) {
14047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14048 LDKUpdateFailHTLC this_obj_conv;
14049 this_obj_conv.inner = (void*)(this_obj & (~1));
14050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14051 UpdateFailHTLC_free(this_obj_conv);
14054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14055 LDKUpdateFailHTLC this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = false;
14058 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14059 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
14063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14064 LDKUpdateFailHTLC this_ptr_conv;
14065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14066 this_ptr_conv.is_owned = false;
14067 LDKThirtyTwoBytes val_ref;
14068 CHECK((*env)->GetArrayLength(env, val) == 32);
14069 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14070 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
14073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14074 LDKUpdateFailHTLC this_ptr_conv;
14075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14076 this_ptr_conv.is_owned = false;
14077 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
14081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14082 LDKUpdateFailHTLC this_ptr_conv;
14083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14084 this_ptr_conv.is_owned = false;
14085 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
14088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14089 LDKUpdateFailHTLC orig_conv;
14090 orig_conv.inner = (void*)(orig & (~1));
14091 orig_conv.is_owned = false;
14092 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
14093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14095 long ret_ref = (long)ret_var.inner;
14096 if (ret_var.is_owned) {
14102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14103 LDKUpdateFailMalformedHTLC this_obj_conv;
14104 this_obj_conv.inner = (void*)(this_obj & (~1));
14105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14106 UpdateFailMalformedHTLC_free(this_obj_conv);
14109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14110 LDKUpdateFailMalformedHTLC this_ptr_conv;
14111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14112 this_ptr_conv.is_owned = false;
14113 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14114 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
14118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14119 LDKUpdateFailMalformedHTLC this_ptr_conv;
14120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14121 this_ptr_conv.is_owned = false;
14122 LDKThirtyTwoBytes val_ref;
14123 CHECK((*env)->GetArrayLength(env, val) == 32);
14124 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14125 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
14128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14129 LDKUpdateFailMalformedHTLC this_ptr_conv;
14130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14131 this_ptr_conv.is_owned = false;
14132 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
14136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14137 LDKUpdateFailMalformedHTLC this_ptr_conv;
14138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14139 this_ptr_conv.is_owned = false;
14140 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
14143 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
14144 LDKUpdateFailMalformedHTLC this_ptr_conv;
14145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14146 this_ptr_conv.is_owned = false;
14147 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
14151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14152 LDKUpdateFailMalformedHTLC this_ptr_conv;
14153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14154 this_ptr_conv.is_owned = false;
14155 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
14158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14159 LDKUpdateFailMalformedHTLC orig_conv;
14160 orig_conv.inner = (void*)(orig & (~1));
14161 orig_conv.is_owned = false;
14162 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
14163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14165 long ret_ref = (long)ret_var.inner;
14166 if (ret_var.is_owned) {
14172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14173 LDKCommitmentSigned this_obj_conv;
14174 this_obj_conv.inner = (void*)(this_obj & (~1));
14175 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14176 CommitmentSigned_free(this_obj_conv);
14179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14180 LDKCommitmentSigned this_ptr_conv;
14181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14182 this_ptr_conv.is_owned = false;
14183 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14184 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
14188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14189 LDKCommitmentSigned this_ptr_conv;
14190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14191 this_ptr_conv.is_owned = false;
14192 LDKThirtyTwoBytes val_ref;
14193 CHECK((*env)->GetArrayLength(env, val) == 32);
14194 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14195 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
14198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14199 LDKCommitmentSigned this_ptr_conv;
14200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14201 this_ptr_conv.is_owned = false;
14202 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14203 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
14207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14208 LDKCommitmentSigned this_ptr_conv;
14209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14210 this_ptr_conv.is_owned = false;
14211 LDKSignature val_ref;
14212 CHECK((*env)->GetArrayLength(env, val) == 64);
14213 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14214 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
14217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
14218 LDKCommitmentSigned this_ptr_conv;
14219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14220 this_ptr_conv.is_owned = false;
14221 LDKCVec_SignatureZ val_constr;
14222 val_constr.datalen = (*env)->GetArrayLength(env, val);
14223 if (val_constr.datalen > 0)
14224 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14226 val_constr.data = NULL;
14227 for (size_t i = 0; i < val_constr.datalen; i++) {
14228 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
14229 LDKSignature val_conv_8_ref;
14230 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
14231 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
14232 val_constr.data[i] = val_conv_8_ref;
14234 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
14237 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) {
14238 LDKThirtyTwoBytes channel_id_arg_ref;
14239 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14240 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14241 LDKSignature signature_arg_ref;
14242 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14243 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14244 LDKCVec_SignatureZ htlc_signatures_arg_constr;
14245 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
14246 if (htlc_signatures_arg_constr.datalen > 0)
14247 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14249 htlc_signatures_arg_constr.data = NULL;
14250 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
14251 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
14252 LDKSignature htlc_signatures_arg_conv_8_ref;
14253 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
14254 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
14255 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
14257 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
14258 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14259 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14260 long ret_ref = (long)ret_var.inner;
14261 if (ret_var.is_owned) {
14267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14268 LDKCommitmentSigned orig_conv;
14269 orig_conv.inner = (void*)(orig & (~1));
14270 orig_conv.is_owned = false;
14271 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
14272 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14273 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14274 long ret_ref = (long)ret_var.inner;
14275 if (ret_var.is_owned) {
14281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14282 LDKRevokeAndACK this_obj_conv;
14283 this_obj_conv.inner = (void*)(this_obj & (~1));
14284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14285 RevokeAndACK_free(this_obj_conv);
14288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14289 LDKRevokeAndACK this_ptr_conv;
14290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14291 this_ptr_conv.is_owned = false;
14292 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
14297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14298 LDKRevokeAndACK this_ptr_conv;
14299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14300 this_ptr_conv.is_owned = false;
14301 LDKThirtyTwoBytes val_ref;
14302 CHECK((*env)->GetArrayLength(env, val) == 32);
14303 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14304 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
14307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14308 LDKRevokeAndACK this_ptr_conv;
14309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14310 this_ptr_conv.is_owned = false;
14311 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
14316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14317 LDKRevokeAndACK this_ptr_conv;
14318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14319 this_ptr_conv.is_owned = false;
14320 LDKThirtyTwoBytes val_ref;
14321 CHECK((*env)->GetArrayLength(env, val) == 32);
14322 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14323 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
14326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14327 LDKRevokeAndACK this_ptr_conv;
14328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14329 this_ptr_conv.is_owned = false;
14330 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
14335 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) {
14336 LDKRevokeAndACK this_ptr_conv;
14337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14338 this_ptr_conv.is_owned = false;
14339 LDKPublicKey val_ref;
14340 CHECK((*env)->GetArrayLength(env, val) == 33);
14341 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14342 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
14345 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) {
14346 LDKThirtyTwoBytes channel_id_arg_ref;
14347 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14348 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14349 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
14350 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
14351 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
14352 LDKPublicKey next_per_commitment_point_arg_ref;
14353 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
14354 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
14355 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
14356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14358 long ret_ref = (long)ret_var.inner;
14359 if (ret_var.is_owned) {
14365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14366 LDKRevokeAndACK orig_conv;
14367 orig_conv.inner = (void*)(orig & (~1));
14368 orig_conv.is_owned = false;
14369 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
14370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14372 long ret_ref = (long)ret_var.inner;
14373 if (ret_var.is_owned) {
14379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14380 LDKUpdateFee this_obj_conv;
14381 this_obj_conv.inner = (void*)(this_obj & (~1));
14382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14383 UpdateFee_free(this_obj_conv);
14386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14387 LDKUpdateFee this_ptr_conv;
14388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14389 this_ptr_conv.is_owned = false;
14390 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
14395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14396 LDKUpdateFee this_ptr_conv;
14397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14398 this_ptr_conv.is_owned = false;
14399 LDKThirtyTwoBytes val_ref;
14400 CHECK((*env)->GetArrayLength(env, val) == 32);
14401 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14402 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14405 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
14406 LDKUpdateFee this_ptr_conv;
14407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14408 this_ptr_conv.is_owned = false;
14409 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14414 LDKUpdateFee this_ptr_conv;
14415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14416 this_ptr_conv.is_owned = false;
14417 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14420 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) {
14421 LDKThirtyTwoBytes channel_id_arg_ref;
14422 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14423 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14424 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14427 long ret_ref = (long)ret_var.inner;
14428 if (ret_var.is_owned) {
14434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14435 LDKUpdateFee orig_conv;
14436 orig_conv.inner = (void*)(orig & (~1));
14437 orig_conv.is_owned = false;
14438 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14441 long ret_ref = (long)ret_var.inner;
14442 if (ret_var.is_owned) {
14448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14449 LDKDataLossProtect this_obj_conv;
14450 this_obj_conv.inner = (void*)(this_obj & (~1));
14451 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14452 DataLossProtect_free(this_obj_conv);
14455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14456 LDKDataLossProtect this_ptr_conv;
14457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14458 this_ptr_conv.is_owned = false;
14459 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14460 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
14464 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) {
14465 LDKDataLossProtect this_ptr_conv;
14466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14467 this_ptr_conv.is_owned = false;
14468 LDKThirtyTwoBytes val_ref;
14469 CHECK((*env)->GetArrayLength(env, val) == 32);
14470 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14471 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14475 LDKDataLossProtect this_ptr_conv;
14476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14477 this_ptr_conv.is_owned = false;
14478 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14479 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
14483 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) {
14484 LDKDataLossProtect this_ptr_conv;
14485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14486 this_ptr_conv.is_owned = false;
14487 LDKPublicKey val_ref;
14488 CHECK((*env)->GetArrayLength(env, val) == 33);
14489 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14490 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14493 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) {
14494 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14495 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
14496 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
14497 LDKPublicKey my_current_per_commitment_point_arg_ref;
14498 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
14499 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
14500 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14503 long ret_ref = (long)ret_var.inner;
14504 if (ret_var.is_owned) {
14510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14511 LDKDataLossProtect orig_conv;
14512 orig_conv.inner = (void*)(orig & (~1));
14513 orig_conv.is_owned = false;
14514 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14517 long ret_ref = (long)ret_var.inner;
14518 if (ret_var.is_owned) {
14524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14525 LDKChannelReestablish this_obj_conv;
14526 this_obj_conv.inner = (void*)(this_obj & (~1));
14527 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14528 ChannelReestablish_free(this_obj_conv);
14531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14532 LDKChannelReestablish this_ptr_conv;
14533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14534 this_ptr_conv.is_owned = false;
14535 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14536 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
14540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14541 LDKChannelReestablish this_ptr_conv;
14542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14543 this_ptr_conv.is_owned = false;
14544 LDKThirtyTwoBytes val_ref;
14545 CHECK((*env)->GetArrayLength(env, val) == 32);
14546 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14547 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14551 LDKChannelReestablish this_ptr_conv;
14552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14553 this_ptr_conv.is_owned = false;
14554 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14558 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) {
14559 LDKChannelReestablish this_ptr_conv;
14560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14561 this_ptr_conv.is_owned = false;
14562 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14566 LDKChannelReestablish this_ptr_conv;
14567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14568 this_ptr_conv.is_owned = false;
14569 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14573 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) {
14574 LDKChannelReestablish this_ptr_conv;
14575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14576 this_ptr_conv.is_owned = false;
14577 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14581 LDKChannelReestablish orig_conv;
14582 orig_conv.inner = (void*)(orig & (~1));
14583 orig_conv.is_owned = false;
14584 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14587 long ret_ref = (long)ret_var.inner;
14588 if (ret_var.is_owned) {
14594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14595 LDKAnnouncementSignatures this_obj_conv;
14596 this_obj_conv.inner = (void*)(this_obj & (~1));
14597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14598 AnnouncementSignatures_free(this_obj_conv);
14601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14602 LDKAnnouncementSignatures this_ptr_conv;
14603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14604 this_ptr_conv.is_owned = false;
14605 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14606 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
14610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14611 LDKAnnouncementSignatures this_ptr_conv;
14612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14613 this_ptr_conv.is_owned = false;
14614 LDKThirtyTwoBytes val_ref;
14615 CHECK((*env)->GetArrayLength(env, val) == 32);
14616 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14617 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
14620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14621 LDKAnnouncementSignatures this_ptr_conv;
14622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14623 this_ptr_conv.is_owned = false;
14624 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
14628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14629 LDKAnnouncementSignatures this_ptr_conv;
14630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14631 this_ptr_conv.is_owned = false;
14632 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
14635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14636 LDKAnnouncementSignatures this_ptr_conv;
14637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14638 this_ptr_conv.is_owned = false;
14639 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
14644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14645 LDKAnnouncementSignatures this_ptr_conv;
14646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14647 this_ptr_conv.is_owned = false;
14648 LDKSignature val_ref;
14649 CHECK((*env)->GetArrayLength(env, val) == 64);
14650 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14651 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
14654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14655 LDKAnnouncementSignatures this_ptr_conv;
14656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14657 this_ptr_conv.is_owned = false;
14658 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
14663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14664 LDKAnnouncementSignatures this_ptr_conv;
14665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14666 this_ptr_conv.is_owned = false;
14667 LDKSignature val_ref;
14668 CHECK((*env)->GetArrayLength(env, val) == 64);
14669 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14670 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
14673 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) {
14674 LDKThirtyTwoBytes channel_id_arg_ref;
14675 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14676 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14677 LDKSignature node_signature_arg_ref;
14678 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
14679 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
14680 LDKSignature bitcoin_signature_arg_ref;
14681 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
14682 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
14683 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
14684 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14685 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14686 long ret_ref = (long)ret_var.inner;
14687 if (ret_var.is_owned) {
14693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14694 LDKAnnouncementSignatures orig_conv;
14695 orig_conv.inner = (void*)(orig & (~1));
14696 orig_conv.is_owned = false;
14697 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
14698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14700 long ret_ref = (long)ret_var.inner;
14701 if (ret_var.is_owned) {
14707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14708 if ((this_ptr & 1) != 0) return;
14709 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
14710 FREE((void*)this_ptr);
14711 NetAddress_free(this_ptr_conv);
14714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14715 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
14716 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
14717 *ret_copy = NetAddress_clone(orig_conv);
14718 long ret_ref = (long)ret_copy;
14722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
14723 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
14724 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
14725 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14726 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14727 CVec_u8Z_free(ret_var);
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14732 LDKu8slice ser_ref;
14733 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14734 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14735 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14736 *ret_conv = Result_read(ser_ref);
14737 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14738 return (long)ret_conv;
14741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14742 LDKUnsignedNodeAnnouncement this_obj_conv;
14743 this_obj_conv.inner = (void*)(this_obj & (~1));
14744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14745 UnsignedNodeAnnouncement_free(this_obj_conv);
14748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
14749 LDKUnsignedNodeAnnouncement this_ptr_conv;
14750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14751 this_ptr_conv.is_owned = false;
14752 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
14753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14755 long ret_ref = (long)ret_var.inner;
14756 if (ret_var.is_owned) {
14762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14763 LDKUnsignedNodeAnnouncement this_ptr_conv;
14764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14765 this_ptr_conv.is_owned = false;
14766 LDKNodeFeatures val_conv;
14767 val_conv.inner = (void*)(val & (~1));
14768 val_conv.is_owned = (val & 1) || (val == 0);
14769 val_conv = NodeFeatures_clone(&val_conv);
14770 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
14773 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
14774 LDKUnsignedNodeAnnouncement this_ptr_conv;
14775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14776 this_ptr_conv.is_owned = false;
14777 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
14781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14782 LDKUnsignedNodeAnnouncement this_ptr_conv;
14783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14784 this_ptr_conv.is_owned = false;
14785 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
14788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14789 LDKUnsignedNodeAnnouncement this_ptr_conv;
14790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14791 this_ptr_conv.is_owned = false;
14792 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14793 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
14797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14798 LDKUnsignedNodeAnnouncement this_ptr_conv;
14799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14800 this_ptr_conv.is_owned = false;
14801 LDKPublicKey val_ref;
14802 CHECK((*env)->GetArrayLength(env, val) == 33);
14803 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14804 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
14807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
14808 LDKUnsignedNodeAnnouncement this_ptr_conv;
14809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14810 this_ptr_conv.is_owned = false;
14811 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
14812 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
14816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14817 LDKUnsignedNodeAnnouncement this_ptr_conv;
14818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14819 this_ptr_conv.is_owned = false;
14820 LDKThreeBytes val_ref;
14821 CHECK((*env)->GetArrayLength(env, val) == 3);
14822 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
14823 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
14826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
14827 LDKUnsignedNodeAnnouncement this_ptr_conv;
14828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14829 this_ptr_conv.is_owned = false;
14830 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14831 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
14835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14836 LDKUnsignedNodeAnnouncement this_ptr_conv;
14837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14838 this_ptr_conv.is_owned = false;
14839 LDKThirtyTwoBytes val_ref;
14840 CHECK((*env)->GetArrayLength(env, val) == 32);
14841 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14842 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
14845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14846 LDKUnsignedNodeAnnouncement this_ptr_conv;
14847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14848 this_ptr_conv.is_owned = false;
14849 LDKCVec_NetAddressZ val_constr;
14850 val_constr.datalen = (*env)->GetArrayLength(env, val);
14851 if (val_constr.datalen > 0)
14852 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14854 val_constr.data = NULL;
14855 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14856 for (size_t m = 0; m < val_constr.datalen; m++) {
14857 int64_t val_conv_12 = val_vals[m];
14858 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
14859 FREE((void*)val_conv_12);
14860 val_constr.data[m] = val_conv_12_conv;
14862 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14863 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
14866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14867 LDKUnsignedNodeAnnouncement orig_conv;
14868 orig_conv.inner = (void*)(orig & (~1));
14869 orig_conv.is_owned = false;
14870 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
14871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14873 long ret_ref = (long)ret_var.inner;
14874 if (ret_var.is_owned) {
14880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14881 LDKNodeAnnouncement this_obj_conv;
14882 this_obj_conv.inner = (void*)(this_obj & (~1));
14883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14884 NodeAnnouncement_free(this_obj_conv);
14887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14888 LDKNodeAnnouncement this_ptr_conv;
14889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14890 this_ptr_conv.is_owned = false;
14891 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
14896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14897 LDKNodeAnnouncement this_ptr_conv;
14898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14899 this_ptr_conv.is_owned = false;
14900 LDKSignature val_ref;
14901 CHECK((*env)->GetArrayLength(env, val) == 64);
14902 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14903 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14907 LDKNodeAnnouncement this_ptr_conv;
14908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14909 this_ptr_conv.is_owned = false;
14910 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14913 long ret_ref = (long)ret_var.inner;
14914 if (ret_var.is_owned) {
14920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14921 LDKNodeAnnouncement this_ptr_conv;
14922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14923 this_ptr_conv.is_owned = false;
14924 LDKUnsignedNodeAnnouncement val_conv;
14925 val_conv.inner = (void*)(val & (~1));
14926 val_conv.is_owned = (val & 1) || (val == 0);
14927 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14928 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
14932 LDKSignature signature_arg_ref;
14933 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14934 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14935 LDKUnsignedNodeAnnouncement contents_arg_conv;
14936 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14937 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14938 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
14939 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
14940 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14941 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14942 long ret_ref = (long)ret_var.inner;
14943 if (ret_var.is_owned) {
14949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14950 LDKNodeAnnouncement orig_conv;
14951 orig_conv.inner = (void*)(orig & (~1));
14952 orig_conv.is_owned = false;
14953 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
14954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14956 long ret_ref = (long)ret_var.inner;
14957 if (ret_var.is_owned) {
14963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14964 LDKUnsignedChannelAnnouncement this_obj_conv;
14965 this_obj_conv.inner = (void*)(this_obj & (~1));
14966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14967 UnsignedChannelAnnouncement_free(this_obj_conv);
14970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
14971 LDKUnsignedChannelAnnouncement this_ptr_conv;
14972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14973 this_ptr_conv.is_owned = false;
14974 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&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_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14985 LDKUnsignedChannelAnnouncement this_ptr_conv;
14986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14987 this_ptr_conv.is_owned = false;
14988 LDKChannelFeatures val_conv;
14989 val_conv.inner = (void*)(val & (~1));
14990 val_conv.is_owned = (val & 1) || (val == 0);
14991 val_conv = ChannelFeatures_clone(&val_conv);
14992 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
14995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14996 LDKUnsignedChannelAnnouncement this_ptr_conv;
14997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14998 this_ptr_conv.is_owned = false;
14999 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
15004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15005 LDKUnsignedChannelAnnouncement this_ptr_conv;
15006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15007 this_ptr_conv.is_owned = false;
15008 LDKThirtyTwoBytes val_ref;
15009 CHECK((*env)->GetArrayLength(env, val) == 32);
15010 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15011 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
15014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15015 LDKUnsignedChannelAnnouncement this_ptr_conv;
15016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15017 this_ptr_conv.is_owned = false;
15018 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
15022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15023 LDKUnsignedChannelAnnouncement this_ptr_conv;
15024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15025 this_ptr_conv.is_owned = false;
15026 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
15029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15030 LDKUnsignedChannelAnnouncement this_ptr_conv;
15031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15032 this_ptr_conv.is_owned = false;
15033 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
15038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15039 LDKUnsignedChannelAnnouncement this_ptr_conv;
15040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15041 this_ptr_conv.is_owned = false;
15042 LDKPublicKey val_ref;
15043 CHECK((*env)->GetArrayLength(env, val) == 33);
15044 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15045 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
15048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15049 LDKUnsignedChannelAnnouncement this_ptr_conv;
15050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15051 this_ptr_conv.is_owned = false;
15052 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15053 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
15057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15058 LDKUnsignedChannelAnnouncement this_ptr_conv;
15059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15060 this_ptr_conv.is_owned = false;
15061 LDKPublicKey val_ref;
15062 CHECK((*env)->GetArrayLength(env, val) == 33);
15063 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15064 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
15067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15068 LDKUnsignedChannelAnnouncement this_ptr_conv;
15069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15070 this_ptr_conv.is_owned = false;
15071 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15072 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
15076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15077 LDKUnsignedChannelAnnouncement this_ptr_conv;
15078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15079 this_ptr_conv.is_owned = false;
15080 LDKPublicKey val_ref;
15081 CHECK((*env)->GetArrayLength(env, val) == 33);
15082 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15083 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
15086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15087 LDKUnsignedChannelAnnouncement this_ptr_conv;
15088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15089 this_ptr_conv.is_owned = false;
15090 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
15095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15096 LDKUnsignedChannelAnnouncement this_ptr_conv;
15097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15098 this_ptr_conv.is_owned = false;
15099 LDKPublicKey val_ref;
15100 CHECK((*env)->GetArrayLength(env, val) == 33);
15101 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15102 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
15105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15106 LDKUnsignedChannelAnnouncement orig_conv;
15107 orig_conv.inner = (void*)(orig & (~1));
15108 orig_conv.is_owned = false;
15109 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
15110 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15111 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15112 long ret_ref = (long)ret_var.inner;
15113 if (ret_var.is_owned) {
15119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15120 LDKChannelAnnouncement this_obj_conv;
15121 this_obj_conv.inner = (void*)(this_obj & (~1));
15122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15123 ChannelAnnouncement_free(this_obj_conv);
15126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15127 LDKChannelAnnouncement this_ptr_conv;
15128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15129 this_ptr_conv.is_owned = false;
15130 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15131 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
15135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15136 LDKChannelAnnouncement this_ptr_conv;
15137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15138 this_ptr_conv.is_owned = false;
15139 LDKSignature val_ref;
15140 CHECK((*env)->GetArrayLength(env, val) == 64);
15141 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15142 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
15145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15146 LDKChannelAnnouncement this_ptr_conv;
15147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15148 this_ptr_conv.is_owned = false;
15149 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
15154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15155 LDKChannelAnnouncement this_ptr_conv;
15156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15157 this_ptr_conv.is_owned = false;
15158 LDKSignature val_ref;
15159 CHECK((*env)->GetArrayLength(env, val) == 64);
15160 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15161 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
15164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15165 LDKChannelAnnouncement this_ptr_conv;
15166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15167 this_ptr_conv.is_owned = false;
15168 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15169 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
15173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15174 LDKChannelAnnouncement this_ptr_conv;
15175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15176 this_ptr_conv.is_owned = false;
15177 LDKSignature val_ref;
15178 CHECK((*env)->GetArrayLength(env, val) == 64);
15179 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15180 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
15183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15184 LDKChannelAnnouncement this_ptr_conv;
15185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15186 this_ptr_conv.is_owned = false;
15187 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
15192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15193 LDKChannelAnnouncement this_ptr_conv;
15194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15195 this_ptr_conv.is_owned = false;
15196 LDKSignature val_ref;
15197 CHECK((*env)->GetArrayLength(env, val) == 64);
15198 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15199 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
15202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15203 LDKChannelAnnouncement this_ptr_conv;
15204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15205 this_ptr_conv.is_owned = false;
15206 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
15207 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15208 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15209 long ret_ref = (long)ret_var.inner;
15210 if (ret_var.is_owned) {
15216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15217 LDKChannelAnnouncement this_ptr_conv;
15218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15219 this_ptr_conv.is_owned = false;
15220 LDKUnsignedChannelAnnouncement val_conv;
15221 val_conv.inner = (void*)(val & (~1));
15222 val_conv.is_owned = (val & 1) || (val == 0);
15223 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
15224 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
15227 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) {
15228 LDKSignature node_signature_1_arg_ref;
15229 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
15230 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
15231 LDKSignature node_signature_2_arg_ref;
15232 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
15233 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
15234 LDKSignature bitcoin_signature_1_arg_ref;
15235 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
15236 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
15237 LDKSignature bitcoin_signature_2_arg_ref;
15238 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
15239 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
15240 LDKUnsignedChannelAnnouncement contents_arg_conv;
15241 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15242 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15243 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
15244 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);
15245 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15246 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15247 long ret_ref = (long)ret_var.inner;
15248 if (ret_var.is_owned) {
15254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15255 LDKChannelAnnouncement orig_conv;
15256 orig_conv.inner = (void*)(orig & (~1));
15257 orig_conv.is_owned = false;
15258 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
15259 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15260 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15261 long ret_ref = (long)ret_var.inner;
15262 if (ret_var.is_owned) {
15268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15269 LDKUnsignedChannelUpdate this_obj_conv;
15270 this_obj_conv.inner = (void*)(this_obj & (~1));
15271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15272 UnsignedChannelUpdate_free(this_obj_conv);
15275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15276 LDKUnsignedChannelUpdate this_ptr_conv;
15277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15278 this_ptr_conv.is_owned = false;
15279 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15280 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
15284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15285 LDKUnsignedChannelUpdate this_ptr_conv;
15286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15287 this_ptr_conv.is_owned = false;
15288 LDKThirtyTwoBytes val_ref;
15289 CHECK((*env)->GetArrayLength(env, val) == 32);
15290 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15291 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
15294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15295 LDKUnsignedChannelUpdate this_ptr_conv;
15296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15297 this_ptr_conv.is_owned = false;
15298 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
15302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15303 LDKUnsignedChannelUpdate this_ptr_conv;
15304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15305 this_ptr_conv.is_owned = false;
15306 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
15309 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15310 LDKUnsignedChannelUpdate this_ptr_conv;
15311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15312 this_ptr_conv.is_owned = false;
15313 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
15317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15318 LDKUnsignedChannelUpdate this_ptr_conv;
15319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15320 this_ptr_conv.is_owned = false;
15321 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
15324 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
15325 LDKUnsignedChannelUpdate this_ptr_conv;
15326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15327 this_ptr_conv.is_owned = false;
15328 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
15332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
15333 LDKUnsignedChannelUpdate this_ptr_conv;
15334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15335 this_ptr_conv.is_owned = false;
15336 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
15339 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(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 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
15347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15348 LDKUnsignedChannelUpdate this_ptr_conv;
15349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15350 this_ptr_conv.is_owned = false;
15351 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
15354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15355 LDKUnsignedChannelUpdate this_ptr_conv;
15356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15357 this_ptr_conv.is_owned = false;
15358 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
15362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15363 LDKUnsignedChannelUpdate this_ptr_conv;
15364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15365 this_ptr_conv.is_owned = false;
15366 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
15369 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15370 LDKUnsignedChannelUpdate this_ptr_conv;
15371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15372 this_ptr_conv.is_owned = false;
15373 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
15377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15378 LDKUnsignedChannelUpdate this_ptr_conv;
15379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15380 this_ptr_conv.is_owned = false;
15381 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
15384 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15385 LDKUnsignedChannelUpdate this_ptr_conv;
15386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15387 this_ptr_conv.is_owned = false;
15388 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
15392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15393 LDKUnsignedChannelUpdate this_ptr_conv;
15394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15395 this_ptr_conv.is_owned = false;
15396 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
15399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15400 LDKUnsignedChannelUpdate orig_conv;
15401 orig_conv.inner = (void*)(orig & (~1));
15402 orig_conv.is_owned = false;
15403 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
15404 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15405 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15406 long ret_ref = (long)ret_var.inner;
15407 if (ret_var.is_owned) {
15413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15414 LDKChannelUpdate this_obj_conv;
15415 this_obj_conv.inner = (void*)(this_obj & (~1));
15416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15417 ChannelUpdate_free(this_obj_conv);
15420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15421 LDKChannelUpdate this_ptr_conv;
15422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15423 this_ptr_conv.is_owned = false;
15424 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15425 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
15429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15430 LDKChannelUpdate this_ptr_conv;
15431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15432 this_ptr_conv.is_owned = false;
15433 LDKSignature val_ref;
15434 CHECK((*env)->GetArrayLength(env, val) == 64);
15435 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15436 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15440 LDKChannelUpdate this_ptr_conv;
15441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15442 this_ptr_conv.is_owned = false;
15443 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
15444 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15445 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15446 long ret_ref = (long)ret_var.inner;
15447 if (ret_var.is_owned) {
15453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15454 LDKChannelUpdate this_ptr_conv;
15455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15456 this_ptr_conv.is_owned = false;
15457 LDKUnsignedChannelUpdate val_conv;
15458 val_conv.inner = (void*)(val & (~1));
15459 val_conv.is_owned = (val & 1) || (val == 0);
15460 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15461 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
15465 LDKSignature signature_arg_ref;
15466 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
15467 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
15468 LDKUnsignedChannelUpdate contents_arg_conv;
15469 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15470 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15471 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15472 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15475 long ret_ref = (long)ret_var.inner;
15476 if (ret_var.is_owned) {
15482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15483 LDKChannelUpdate orig_conv;
15484 orig_conv.inner = (void*)(orig & (~1));
15485 orig_conv.is_owned = false;
15486 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15489 long ret_ref = (long)ret_var.inner;
15490 if (ret_var.is_owned) {
15496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15497 LDKQueryChannelRange this_obj_conv;
15498 this_obj_conv.inner = (void*)(this_obj & (~1));
15499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15500 QueryChannelRange_free(this_obj_conv);
15503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15504 LDKQueryChannelRange this_ptr_conv;
15505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15506 this_ptr_conv.is_owned = false;
15507 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15508 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
15512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15513 LDKQueryChannelRange this_ptr_conv;
15514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15515 this_ptr_conv.is_owned = false;
15516 LDKThirtyTwoBytes val_ref;
15517 CHECK((*env)->GetArrayLength(env, val) == 32);
15518 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15519 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15522 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15523 LDKQueryChannelRange this_ptr_conv;
15524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15525 this_ptr_conv.is_owned = false;
15526 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15531 LDKQueryChannelRange this_ptr_conv;
15532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15533 this_ptr_conv.is_owned = false;
15534 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15538 LDKQueryChannelRange this_ptr_conv;
15539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15540 this_ptr_conv.is_owned = false;
15541 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15546 LDKQueryChannelRange this_ptr_conv;
15547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15548 this_ptr_conv.is_owned = false;
15549 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15552 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) {
15553 LDKThirtyTwoBytes chain_hash_arg_ref;
15554 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15555 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15556 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15559 long ret_ref = (long)ret_var.inner;
15560 if (ret_var.is_owned) {
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15567 LDKQueryChannelRange orig_conv;
15568 orig_conv.inner = (void*)(orig & (~1));
15569 orig_conv.is_owned = false;
15570 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15573 long ret_ref = (long)ret_var.inner;
15574 if (ret_var.is_owned) {
15580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15581 LDKReplyChannelRange this_obj_conv;
15582 this_obj_conv.inner = (void*)(this_obj & (~1));
15583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15584 ReplyChannelRange_free(this_obj_conv);
15587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15588 LDKReplyChannelRange this_ptr_conv;
15589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15590 this_ptr_conv.is_owned = false;
15591 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15592 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
15596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15597 LDKReplyChannelRange this_ptr_conv;
15598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15599 this_ptr_conv.is_owned = false;
15600 LDKThirtyTwoBytes val_ref;
15601 CHECK((*env)->GetArrayLength(env, val) == 32);
15602 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15603 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15606 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15607 LDKReplyChannelRange this_ptr_conv;
15608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15609 this_ptr_conv.is_owned = false;
15610 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
15614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15615 LDKReplyChannelRange this_ptr_conv;
15616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15617 this_ptr_conv.is_owned = false;
15618 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
15621 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15622 LDKReplyChannelRange this_ptr_conv;
15623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15624 this_ptr_conv.is_owned = false;
15625 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
15629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15630 LDKReplyChannelRange this_ptr_conv;
15631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15632 this_ptr_conv.is_owned = false;
15633 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
15637 LDKReplyChannelRange this_ptr_conv;
15638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15639 this_ptr_conv.is_owned = false;
15640 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
15644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15645 LDKReplyChannelRange this_ptr_conv;
15646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15647 this_ptr_conv.is_owned = false;
15648 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
15651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15652 LDKReplyChannelRange this_ptr_conv;
15653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15654 this_ptr_conv.is_owned = false;
15655 LDKCVec_u64Z val_constr;
15656 val_constr.datalen = (*env)->GetArrayLength(env, val);
15657 if (val_constr.datalen > 0)
15658 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15660 val_constr.data = NULL;
15661 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15662 for (size_t g = 0; g < val_constr.datalen; g++) {
15663 int64_t val_conv_6 = val_vals[g];
15664 val_constr.data[g] = val_conv_6;
15666 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15667 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
15670 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) {
15671 LDKThirtyTwoBytes chain_hash_arg_ref;
15672 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15673 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15674 LDKCVec_u64Z short_channel_ids_arg_constr;
15675 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15676 if (short_channel_ids_arg_constr.datalen > 0)
15677 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15679 short_channel_ids_arg_constr.data = NULL;
15680 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15681 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15682 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15683 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15685 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15686 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
15687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15689 long ret_ref = (long)ret_var.inner;
15690 if (ret_var.is_owned) {
15696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15697 LDKReplyChannelRange orig_conv;
15698 orig_conv.inner = (void*)(orig & (~1));
15699 orig_conv.is_owned = false;
15700 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
15701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15703 long ret_ref = (long)ret_var.inner;
15704 if (ret_var.is_owned) {
15710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15711 LDKQueryShortChannelIds this_obj_conv;
15712 this_obj_conv.inner = (void*)(this_obj & (~1));
15713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15714 QueryShortChannelIds_free(this_obj_conv);
15717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15718 LDKQueryShortChannelIds this_ptr_conv;
15719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15720 this_ptr_conv.is_owned = false;
15721 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15722 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
15726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15727 LDKQueryShortChannelIds this_ptr_conv;
15728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15729 this_ptr_conv.is_owned = false;
15730 LDKThirtyTwoBytes val_ref;
15731 CHECK((*env)->GetArrayLength(env, val) == 32);
15732 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15733 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
15736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15737 LDKQueryShortChannelIds this_ptr_conv;
15738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15739 this_ptr_conv.is_owned = false;
15740 LDKCVec_u64Z val_constr;
15741 val_constr.datalen = (*env)->GetArrayLength(env, val);
15742 if (val_constr.datalen > 0)
15743 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15745 val_constr.data = NULL;
15746 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15747 for (size_t g = 0; g < val_constr.datalen; g++) {
15748 int64_t val_conv_6 = val_vals[g];
15749 val_constr.data[g] = val_conv_6;
15751 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15752 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
15755 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) {
15756 LDKThirtyTwoBytes chain_hash_arg_ref;
15757 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15758 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15759 LDKCVec_u64Z short_channel_ids_arg_constr;
15760 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
15761 if (short_channel_ids_arg_constr.datalen > 0)
15762 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15764 short_channel_ids_arg_constr.data = NULL;
15765 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
15766 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
15767 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
15768 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
15770 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
15771 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
15772 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15773 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15774 long ret_ref = (long)ret_var.inner;
15775 if (ret_var.is_owned) {
15781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15782 LDKQueryShortChannelIds orig_conv;
15783 orig_conv.inner = (void*)(orig & (~1));
15784 orig_conv.is_owned = false;
15785 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
15786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15788 long ret_ref = (long)ret_var.inner;
15789 if (ret_var.is_owned) {
15795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15796 LDKReplyShortChannelIdsEnd this_obj_conv;
15797 this_obj_conv.inner = (void*)(this_obj & (~1));
15798 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15799 ReplyShortChannelIdsEnd_free(this_obj_conv);
15802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15803 LDKReplyShortChannelIdsEnd this_ptr_conv;
15804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15805 this_ptr_conv.is_owned = false;
15806 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15807 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
15811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15812 LDKReplyShortChannelIdsEnd this_ptr_conv;
15813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15814 this_ptr_conv.is_owned = false;
15815 LDKThirtyTwoBytes val_ref;
15816 CHECK((*env)->GetArrayLength(env, val) == 32);
15817 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15818 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
15821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
15822 LDKReplyShortChannelIdsEnd this_ptr_conv;
15823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15824 this_ptr_conv.is_owned = false;
15825 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
15829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15830 LDKReplyShortChannelIdsEnd this_ptr_conv;
15831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15832 this_ptr_conv.is_owned = false;
15833 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
15836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
15837 LDKThirtyTwoBytes chain_hash_arg_ref;
15838 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15839 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15840 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
15841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15843 long ret_ref = (long)ret_var.inner;
15844 if (ret_var.is_owned) {
15850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15851 LDKReplyShortChannelIdsEnd orig_conv;
15852 orig_conv.inner = (void*)(orig & (~1));
15853 orig_conv.is_owned = false;
15854 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
15855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15857 long ret_ref = (long)ret_var.inner;
15858 if (ret_var.is_owned) {
15864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15865 LDKGossipTimestampFilter this_obj_conv;
15866 this_obj_conv.inner = (void*)(this_obj & (~1));
15867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15868 GossipTimestampFilter_free(this_obj_conv);
15871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15872 LDKGossipTimestampFilter this_ptr_conv;
15873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15874 this_ptr_conv.is_owned = false;
15875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
15880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15881 LDKGossipTimestampFilter this_ptr_conv;
15882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15883 this_ptr_conv.is_owned = false;
15884 LDKThirtyTwoBytes val_ref;
15885 CHECK((*env)->GetArrayLength(env, val) == 32);
15886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15887 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15890 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15891 LDKGossipTimestampFilter this_ptr_conv;
15892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15893 this_ptr_conv.is_owned = false;
15894 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15899 LDKGossipTimestampFilter this_ptr_conv;
15900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15901 this_ptr_conv.is_owned = false;
15902 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
15906 LDKGossipTimestampFilter this_ptr_conv;
15907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15908 this_ptr_conv.is_owned = false;
15909 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15914 LDKGossipTimestampFilter this_ptr_conv;
15915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15916 this_ptr_conv.is_owned = false;
15917 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15920 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) {
15921 LDKThirtyTwoBytes chain_hash_arg_ref;
15922 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15923 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15924 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15927 long ret_ref = (long)ret_var.inner;
15928 if (ret_var.is_owned) {
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15935 LDKGossipTimestampFilter orig_conv;
15936 orig_conv.inner = (void*)(orig & (~1));
15937 orig_conv.is_owned = false;
15938 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
15939 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15940 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15941 long ret_ref = (long)ret_var.inner;
15942 if (ret_var.is_owned) {
15948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15949 if ((this_ptr & 1) != 0) return;
15950 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
15951 FREE((void*)this_ptr);
15952 ErrorAction_free(this_ptr_conv);
15955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15956 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
15957 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15958 *ret_copy = ErrorAction_clone(orig_conv);
15959 long ret_ref = (long)ret_copy;
15963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15964 LDKLightningError this_obj_conv;
15965 this_obj_conv.inner = (void*)(this_obj & (~1));
15966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15967 LightningError_free(this_obj_conv);
15970 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
15971 LDKLightningError this_ptr_conv;
15972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15973 this_ptr_conv.is_owned = false;
15974 LDKStr _str = LightningError_get_err(&this_ptr_conv);
15975 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
15979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15980 LDKLightningError this_ptr_conv;
15981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15982 this_ptr_conv.is_owned = false;
15983 LDKCVec_u8Z val_ref;
15984 val_ref.datalen = (*env)->GetArrayLength(env, val);
15985 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15986 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15987 LightningError_set_err(&this_ptr_conv, val_ref);
15990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
15991 LDKLightningError this_ptr_conv;
15992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15993 this_ptr_conv.is_owned = false;
15994 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15995 *ret_copy = LightningError_get_action(&this_ptr_conv);
15996 long ret_ref = (long)ret_copy;
16000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16001 LDKLightningError this_ptr_conv;
16002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16003 this_ptr_conv.is_owned = false;
16004 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
16006 LightningError_set_action(&this_ptr_conv, val_conv);
16009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
16010 LDKCVec_u8Z err_arg_ref;
16011 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
16012 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16013 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
16014 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
16015 FREE((void*)action_arg);
16016 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
16017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16019 long ret_ref = (long)ret_var.inner;
16020 if (ret_var.is_owned) {
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16027 LDKLightningError orig_conv;
16028 orig_conv.inner = (void*)(orig & (~1));
16029 orig_conv.is_owned = false;
16030 LDKLightningError ret_var = LightningError_clone(&orig_conv);
16031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16033 long ret_ref = (long)ret_var.inner;
16034 if (ret_var.is_owned) {
16040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16041 LDKCommitmentUpdate this_obj_conv;
16042 this_obj_conv.inner = (void*)(this_obj & (~1));
16043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16044 CommitmentUpdate_free(this_obj_conv);
16047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16048 LDKCommitmentUpdate this_ptr_conv;
16049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16050 this_ptr_conv.is_owned = false;
16051 LDKCVec_UpdateAddHTLCZ val_constr;
16052 val_constr.datalen = (*env)->GetArrayLength(env, val);
16053 if (val_constr.datalen > 0)
16054 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16056 val_constr.data = NULL;
16057 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16058 for (size_t p = 0; p < val_constr.datalen; p++) {
16059 int64_t val_conv_15 = val_vals[p];
16060 LDKUpdateAddHTLC val_conv_15_conv;
16061 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
16062 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
16063 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
16064 val_constr.data[p] = val_conv_15_conv;
16066 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16067 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
16070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16071 LDKCommitmentUpdate this_ptr_conv;
16072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16073 this_ptr_conv.is_owned = false;
16074 LDKCVec_UpdateFulfillHTLCZ val_constr;
16075 val_constr.datalen = (*env)->GetArrayLength(env, val);
16076 if (val_constr.datalen > 0)
16077 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16079 val_constr.data = NULL;
16080 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16081 for (size_t t = 0; t < val_constr.datalen; t++) {
16082 int64_t val_conv_19 = val_vals[t];
16083 LDKUpdateFulfillHTLC val_conv_19_conv;
16084 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
16085 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
16086 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
16087 val_constr.data[t] = val_conv_19_conv;
16089 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16090 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
16093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16094 LDKCommitmentUpdate this_ptr_conv;
16095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16096 this_ptr_conv.is_owned = false;
16097 LDKCVec_UpdateFailHTLCZ val_constr;
16098 val_constr.datalen = (*env)->GetArrayLength(env, val);
16099 if (val_constr.datalen > 0)
16100 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16102 val_constr.data = NULL;
16103 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16104 for (size_t q = 0; q < val_constr.datalen; q++) {
16105 int64_t val_conv_16 = val_vals[q];
16106 LDKUpdateFailHTLC val_conv_16_conv;
16107 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
16108 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
16109 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
16110 val_constr.data[q] = val_conv_16_conv;
16112 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16113 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
16116 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) {
16117 LDKCommitmentUpdate this_ptr_conv;
16118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16119 this_ptr_conv.is_owned = false;
16120 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
16121 val_constr.datalen = (*env)->GetArrayLength(env, val);
16122 if (val_constr.datalen > 0)
16123 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16125 val_constr.data = NULL;
16126 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16127 for (size_t z = 0; z < val_constr.datalen; z++) {
16128 int64_t val_conv_25 = val_vals[z];
16129 LDKUpdateFailMalformedHTLC val_conv_25_conv;
16130 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
16131 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
16132 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
16133 val_constr.data[z] = val_conv_25_conv;
16135 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16136 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
16139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
16140 LDKCommitmentUpdate this_ptr_conv;
16141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16142 this_ptr_conv.is_owned = false;
16143 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
16144 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16145 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16146 long ret_ref = (long)ret_var.inner;
16147 if (ret_var.is_owned) {
16153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16154 LDKCommitmentUpdate this_ptr_conv;
16155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16156 this_ptr_conv.is_owned = false;
16157 LDKUpdateFee val_conv;
16158 val_conv.inner = (void*)(val & (~1));
16159 val_conv.is_owned = (val & 1) || (val == 0);
16160 val_conv = UpdateFee_clone(&val_conv);
16161 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
16164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
16165 LDKCommitmentUpdate this_ptr_conv;
16166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16167 this_ptr_conv.is_owned = false;
16168 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
16169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16171 long ret_ref = (long)ret_var.inner;
16172 if (ret_var.is_owned) {
16178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16179 LDKCommitmentUpdate this_ptr_conv;
16180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16181 this_ptr_conv.is_owned = false;
16182 LDKCommitmentSigned val_conv;
16183 val_conv.inner = (void*)(val & (~1));
16184 val_conv.is_owned = (val & 1) || (val == 0);
16185 val_conv = CommitmentSigned_clone(&val_conv);
16186 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
16189 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) {
16190 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
16191 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
16192 if (update_add_htlcs_arg_constr.datalen > 0)
16193 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16195 update_add_htlcs_arg_constr.data = NULL;
16196 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
16197 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
16198 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
16199 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
16200 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
16201 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
16202 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
16203 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
16205 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
16206 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
16207 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
16208 if (update_fulfill_htlcs_arg_constr.datalen > 0)
16209 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16211 update_fulfill_htlcs_arg_constr.data = NULL;
16212 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
16213 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
16214 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
16215 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
16216 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
16217 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
16218 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
16219 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
16221 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
16222 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
16223 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
16224 if (update_fail_htlcs_arg_constr.datalen > 0)
16225 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16227 update_fail_htlcs_arg_constr.data = NULL;
16228 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
16229 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
16230 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
16231 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
16232 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
16233 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
16234 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
16235 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
16237 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
16238 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
16239 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
16240 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
16241 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16243 update_fail_malformed_htlcs_arg_constr.data = NULL;
16244 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
16245 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
16246 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
16247 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
16248 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
16249 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);
16250 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
16251 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
16253 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
16254 LDKUpdateFee update_fee_arg_conv;
16255 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
16256 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
16257 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
16258 LDKCommitmentSigned commitment_signed_arg_conv;
16259 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
16260 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
16261 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
16262 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);
16263 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16264 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16265 long ret_ref = (long)ret_var.inner;
16266 if (ret_var.is_owned) {
16272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16273 LDKCommitmentUpdate orig_conv;
16274 orig_conv.inner = (void*)(orig & (~1));
16275 orig_conv.is_owned = false;
16276 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
16277 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16278 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16279 long ret_ref = (long)ret_var.inner;
16280 if (ret_var.is_owned) {
16286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16287 if ((this_ptr & 1) != 0) return;
16288 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
16289 FREE((void*)this_ptr);
16290 HTLCFailChannelUpdate_free(this_ptr_conv);
16293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16294 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
16295 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
16296 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
16297 long ret_ref = (long)ret_copy;
16301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16302 if ((this_ptr & 1) != 0) return;
16303 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
16304 FREE((void*)this_ptr);
16305 ChannelMessageHandler_free(this_ptr_conv);
16308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16309 if ((this_ptr & 1) != 0) return;
16310 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
16311 FREE((void*)this_ptr);
16312 RoutingMessageHandler_free(this_ptr_conv);
16315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16316 LDKAcceptChannel obj_conv;
16317 obj_conv.inner = (void*)(obj & (~1));
16318 obj_conv.is_owned = false;
16319 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
16320 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16321 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16322 CVec_u8Z_free(ret_var);
16326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16327 LDKu8slice ser_ref;
16328 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16329 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16330 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
16331 *ret_conv = AcceptChannel_read(ser_ref);
16332 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16333 return (long)ret_conv;
16336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
16337 LDKAnnouncementSignatures obj_conv;
16338 obj_conv.inner = (void*)(obj & (~1));
16339 obj_conv.is_owned = false;
16340 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
16341 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16342 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16343 CVec_u8Z_free(ret_var);
16347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16348 LDKu8slice ser_ref;
16349 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16350 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16351 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
16352 *ret_conv = AnnouncementSignatures_read(ser_ref);
16353 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16354 return (long)ret_conv;
16357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
16358 LDKChannelReestablish obj_conv;
16359 obj_conv.inner = (void*)(obj & (~1));
16360 obj_conv.is_owned = false;
16361 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
16362 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16363 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16364 CVec_u8Z_free(ret_var);
16368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16369 LDKu8slice ser_ref;
16370 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16371 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16372 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
16373 *ret_conv = ChannelReestablish_read(ser_ref);
16374 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16375 return (long)ret_conv;
16378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16379 LDKClosingSigned obj_conv;
16380 obj_conv.inner = (void*)(obj & (~1));
16381 obj_conv.is_owned = false;
16382 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
16383 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16384 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16385 CVec_u8Z_free(ret_var);
16389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16390 LDKu8slice ser_ref;
16391 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16392 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16393 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
16394 *ret_conv = ClosingSigned_read(ser_ref);
16395 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16396 return (long)ret_conv;
16399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16400 LDKCommitmentSigned obj_conv;
16401 obj_conv.inner = (void*)(obj & (~1));
16402 obj_conv.is_owned = false;
16403 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
16404 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16405 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16406 CVec_u8Z_free(ret_var);
16410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16411 LDKu8slice ser_ref;
16412 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16413 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16414 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
16415 *ret_conv = CommitmentSigned_read(ser_ref);
16416 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16417 return (long)ret_conv;
16420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
16421 LDKFundingCreated obj_conv;
16422 obj_conv.inner = (void*)(obj & (~1));
16423 obj_conv.is_owned = false;
16424 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16425 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16426 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16427 CVec_u8Z_free(ret_var);
16431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16432 LDKu8slice ser_ref;
16433 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16434 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16435 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16436 *ret_conv = FundingCreated_read(ser_ref);
16437 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16438 return (long)ret_conv;
16441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16442 LDKFundingSigned obj_conv;
16443 obj_conv.inner = (void*)(obj & (~1));
16444 obj_conv.is_owned = false;
16445 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16448 CVec_u8Z_free(ret_var);
16452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16453 LDKu8slice ser_ref;
16454 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16455 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16456 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16457 *ret_conv = FundingSigned_read(ser_ref);
16458 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16459 return (long)ret_conv;
16462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
16463 LDKFundingLocked obj_conv;
16464 obj_conv.inner = (void*)(obj & (~1));
16465 obj_conv.is_owned = false;
16466 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16467 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16468 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16469 CVec_u8Z_free(ret_var);
16473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16474 LDKu8slice ser_ref;
16475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16477 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16478 *ret_conv = FundingLocked_read(ser_ref);
16479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16480 return (long)ret_conv;
16483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
16485 obj_conv.inner = (void*)(obj & (~1));
16486 obj_conv.is_owned = false;
16487 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16488 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16489 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16490 CVec_u8Z_free(ret_var);
16494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16495 LDKu8slice ser_ref;
16496 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16497 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16498 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16499 *ret_conv = Init_read(ser_ref);
16500 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16501 return (long)ret_conv;
16504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16505 LDKOpenChannel obj_conv;
16506 obj_conv.inner = (void*)(obj & (~1));
16507 obj_conv.is_owned = false;
16508 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16509 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16510 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16511 CVec_u8Z_free(ret_var);
16515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16516 LDKu8slice ser_ref;
16517 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16518 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16519 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16520 *ret_conv = OpenChannel_read(ser_ref);
16521 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16522 return (long)ret_conv;
16525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
16526 LDKRevokeAndACK obj_conv;
16527 obj_conv.inner = (void*)(obj & (~1));
16528 obj_conv.is_owned = false;
16529 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16530 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16531 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16532 CVec_u8Z_free(ret_var);
16536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16537 LDKu8slice ser_ref;
16538 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16539 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16540 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16541 *ret_conv = RevokeAndACK_read(ser_ref);
16542 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16543 return (long)ret_conv;
16546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
16547 LDKShutdown obj_conv;
16548 obj_conv.inner = (void*)(obj & (~1));
16549 obj_conv.is_owned = false;
16550 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16551 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16552 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16553 CVec_u8Z_free(ret_var);
16557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16558 LDKu8slice ser_ref;
16559 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16560 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16561 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16562 *ret_conv = Shutdown_read(ser_ref);
16563 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16564 return (long)ret_conv;
16567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16568 LDKUpdateFailHTLC obj_conv;
16569 obj_conv.inner = (void*)(obj & (~1));
16570 obj_conv.is_owned = false;
16571 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16572 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16573 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16574 CVec_u8Z_free(ret_var);
16578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16579 LDKu8slice ser_ref;
16580 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16581 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16582 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16583 *ret_conv = UpdateFailHTLC_read(ser_ref);
16584 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16585 return (long)ret_conv;
16588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16589 LDKUpdateFailMalformedHTLC obj_conv;
16590 obj_conv.inner = (void*)(obj & (~1));
16591 obj_conv.is_owned = false;
16592 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16593 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16594 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16595 CVec_u8Z_free(ret_var);
16599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16600 LDKu8slice ser_ref;
16601 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16602 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16603 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16604 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16605 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16606 return (long)ret_conv;
16609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
16610 LDKUpdateFee obj_conv;
16611 obj_conv.inner = (void*)(obj & (~1));
16612 obj_conv.is_owned = false;
16613 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
16614 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16615 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16616 CVec_u8Z_free(ret_var);
16620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16621 LDKu8slice ser_ref;
16622 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16623 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16624 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16625 *ret_conv = UpdateFee_read(ser_ref);
16626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16627 return (long)ret_conv;
16630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16631 LDKUpdateFulfillHTLC obj_conv;
16632 obj_conv.inner = (void*)(obj & (~1));
16633 obj_conv.is_owned = false;
16634 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
16635 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16636 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16637 CVec_u8Z_free(ret_var);
16641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16642 LDKu8slice ser_ref;
16643 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16644 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16645 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16646 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
16647 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16648 return (long)ret_conv;
16651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16652 LDKUpdateAddHTLC obj_conv;
16653 obj_conv.inner = (void*)(obj & (~1));
16654 obj_conv.is_owned = false;
16655 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
16656 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16657 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16658 CVec_u8Z_free(ret_var);
16662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16663 LDKu8slice ser_ref;
16664 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16665 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16666 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16667 *ret_conv = UpdateAddHTLC_read(ser_ref);
16668 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16669 return (long)ret_conv;
16672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
16674 obj_conv.inner = (void*)(obj & (~1));
16675 obj_conv.is_owned = false;
16676 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
16677 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16678 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16679 CVec_u8Z_free(ret_var);
16683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16684 LDKu8slice ser_ref;
16685 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16686 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16687 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16688 *ret_conv = Ping_read(ser_ref);
16689 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16690 return (long)ret_conv;
16693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
16695 obj_conv.inner = (void*)(obj & (~1));
16696 obj_conv.is_owned = false;
16697 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
16698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16700 CVec_u8Z_free(ret_var);
16704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16705 LDKu8slice ser_ref;
16706 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16707 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16708 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16709 *ret_conv = Pong_read(ser_ref);
16710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16711 return (long)ret_conv;
16714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16715 LDKUnsignedChannelAnnouncement obj_conv;
16716 obj_conv.inner = (void*)(obj & (~1));
16717 obj_conv.is_owned = false;
16718 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
16719 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16720 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16721 CVec_u8Z_free(ret_var);
16725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16726 LDKu8slice ser_ref;
16727 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16728 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16729 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16730 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
16731 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16732 return (long)ret_conv;
16735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16736 LDKChannelAnnouncement obj_conv;
16737 obj_conv.inner = (void*)(obj & (~1));
16738 obj_conv.is_owned = false;
16739 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
16740 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16741 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16742 CVec_u8Z_free(ret_var);
16746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16747 LDKu8slice ser_ref;
16748 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16749 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16750 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16751 *ret_conv = ChannelAnnouncement_read(ser_ref);
16752 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16753 return (long)ret_conv;
16756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16757 LDKUnsignedChannelUpdate obj_conv;
16758 obj_conv.inner = (void*)(obj & (~1));
16759 obj_conv.is_owned = false;
16760 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
16761 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16762 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16763 CVec_u8Z_free(ret_var);
16767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16768 LDKu8slice ser_ref;
16769 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16770 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16771 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16772 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
16773 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16774 return (long)ret_conv;
16777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16778 LDKChannelUpdate obj_conv;
16779 obj_conv.inner = (void*)(obj & (~1));
16780 obj_conv.is_owned = false;
16781 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
16782 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16783 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16784 CVec_u8Z_free(ret_var);
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16789 LDKu8slice ser_ref;
16790 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16791 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16792 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16793 *ret_conv = ChannelUpdate_read(ser_ref);
16794 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16795 return (long)ret_conv;
16798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
16799 LDKErrorMessage obj_conv;
16800 obj_conv.inner = (void*)(obj & (~1));
16801 obj_conv.is_owned = false;
16802 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
16803 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16804 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16805 CVec_u8Z_free(ret_var);
16809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16810 LDKu8slice ser_ref;
16811 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16812 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16813 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16814 *ret_conv = ErrorMessage_read(ser_ref);
16815 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16816 return (long)ret_conv;
16819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16820 LDKUnsignedNodeAnnouncement obj_conv;
16821 obj_conv.inner = (void*)(obj & (~1));
16822 obj_conv.is_owned = false;
16823 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
16824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16826 CVec_u8Z_free(ret_var);
16830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16831 LDKu8slice ser_ref;
16832 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16833 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16834 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16835 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
16836 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16837 return (long)ret_conv;
16840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
16841 LDKNodeAnnouncement obj_conv;
16842 obj_conv.inner = (void*)(obj & (~1));
16843 obj_conv.is_owned = false;
16844 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
16845 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16846 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16847 CVec_u8Z_free(ret_var);
16851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16852 LDKu8slice ser_ref;
16853 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16854 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16855 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16856 *ret_conv = NodeAnnouncement_read(ser_ref);
16857 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16858 return (long)ret_conv;
16861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16862 LDKu8slice ser_ref;
16863 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16864 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16865 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16866 *ret_conv = QueryShortChannelIds_read(ser_ref);
16867 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16868 return (long)ret_conv;
16871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
16872 LDKQueryShortChannelIds obj_conv;
16873 obj_conv.inner = (void*)(obj & (~1));
16874 obj_conv.is_owned = false;
16875 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
16876 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16877 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16878 CVec_u8Z_free(ret_var);
16882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16883 LDKu8slice ser_ref;
16884 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16885 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16886 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16887 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
16888 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16889 return (long)ret_conv;
16892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
16893 LDKReplyShortChannelIdsEnd obj_conv;
16894 obj_conv.inner = (void*)(obj & (~1));
16895 obj_conv.is_owned = false;
16896 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
16897 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16898 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16899 CVec_u8Z_free(ret_var);
16903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16904 LDKu8slice ser_ref;
16905 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16906 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16907 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16908 *ret_conv = QueryChannelRange_read(ser_ref);
16909 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16910 return (long)ret_conv;
16913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
16914 LDKQueryChannelRange obj_conv;
16915 obj_conv.inner = (void*)(obj & (~1));
16916 obj_conv.is_owned = false;
16917 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16918 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16919 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16920 CVec_u8Z_free(ret_var);
16924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16925 LDKu8slice ser_ref;
16926 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16927 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16928 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16929 *ret_conv = ReplyChannelRange_read(ser_ref);
16930 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16931 return (long)ret_conv;
16934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
16935 LDKReplyChannelRange obj_conv;
16936 obj_conv.inner = (void*)(obj & (~1));
16937 obj_conv.is_owned = false;
16938 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
16939 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16940 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16941 CVec_u8Z_free(ret_var);
16945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16946 LDKu8slice ser_ref;
16947 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16948 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16949 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16950 *ret_conv = GossipTimestampFilter_read(ser_ref);
16951 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16952 return (long)ret_conv;
16955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
16956 LDKGossipTimestampFilter obj_conv;
16957 obj_conv.inner = (void*)(obj & (~1));
16958 obj_conv.is_owned = false;
16959 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
16960 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16961 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16962 CVec_u8Z_free(ret_var);
16966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16967 LDKIgnoringMessageHandler this_obj_conv;
16968 this_obj_conv.inner = (void*)(this_obj & (~1));
16969 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16970 IgnoringMessageHandler_free(this_obj_conv);
16973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
16974 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
16975 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16976 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16977 long ret_ref = (long)ret_var.inner;
16978 if (ret_var.is_owned) {
16984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16985 LDKIgnoringMessageHandler this_arg_conv;
16986 this_arg_conv.inner = (void*)(this_arg & (~1));
16987 this_arg_conv.is_owned = false;
16988 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16989 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16994 LDKIgnoringMessageHandler this_arg_conv;
16995 this_arg_conv.inner = (void*)(this_arg & (~1));
16996 this_arg_conv.is_owned = false;
16997 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16998 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
17002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17003 LDKErroringMessageHandler this_obj_conv;
17004 this_obj_conv.inner = (void*)(this_obj & (~1));
17005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17006 ErroringMessageHandler_free(this_obj_conv);
17009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
17010 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
17011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17013 long ret_ref = (long)ret_var.inner;
17014 if (ret_var.is_owned) {
17020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17021 LDKErroringMessageHandler this_arg_conv;
17022 this_arg_conv.inner = (void*)(this_arg & (~1));
17023 this_arg_conv.is_owned = false;
17024 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17025 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
17029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17030 LDKErroringMessageHandler this_arg_conv;
17031 this_arg_conv.inner = (void*)(this_arg & (~1));
17032 this_arg_conv.is_owned = false;
17033 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17034 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
17038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17039 LDKMessageHandler 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 MessageHandler_free(this_obj_conv);
17045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17046 LDKMessageHandler this_ptr_conv;
17047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17048 this_ptr_conv.is_owned = false;
17049 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
17053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17054 LDKMessageHandler this_ptr_conv;
17055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17056 this_ptr_conv.is_owned = false;
17057 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
17058 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
17059 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17060 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
17062 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
17065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17066 LDKMessageHandler this_ptr_conv;
17067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17068 this_ptr_conv.is_owned = false;
17069 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
17073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17074 LDKMessageHandler this_ptr_conv;
17075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17076 this_ptr_conv.is_owned = false;
17077 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
17078 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17079 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17080 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
17082 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
17085 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) {
17086 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
17087 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
17088 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17089 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
17091 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
17092 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17094 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
17096 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
17097 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17098 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17099 long ret_ref = (long)ret_var.inner;
17100 if (ret_var.is_owned) {
17106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17107 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
17108 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17109 *ret = SocketDescriptor_clone(orig_conv);
17113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17114 if ((this_ptr & 1) != 0) return;
17115 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
17116 FREE((void*)this_ptr);
17117 SocketDescriptor_free(this_ptr_conv);
17120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17121 LDKPeerHandleError this_obj_conv;
17122 this_obj_conv.inner = (void*)(this_obj & (~1));
17123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17124 PeerHandleError_free(this_obj_conv);
17127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
17128 LDKPeerHandleError this_ptr_conv;
17129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17130 this_ptr_conv.is_owned = false;
17131 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
17135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17136 LDKPeerHandleError this_ptr_conv;
17137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17138 this_ptr_conv.is_owned = false;
17139 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
17142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
17143 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
17144 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17145 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17146 long ret_ref = (long)ret_var.inner;
17147 if (ret_var.is_owned) {
17153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17154 LDKPeerHandleError orig_conv;
17155 orig_conv.inner = (void*)(orig & (~1));
17156 orig_conv.is_owned = false;
17157 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
17158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17160 long ret_ref = (long)ret_var.inner;
17161 if (ret_var.is_owned) {
17167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17168 LDKPeerManager this_obj_conv;
17169 this_obj_conv.inner = (void*)(this_obj & (~1));
17170 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17171 PeerManager_free(this_obj_conv);
17174 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) {
17175 LDKMessageHandler message_handler_conv;
17176 message_handler_conv.inner = (void*)(message_handler & (~1));
17177 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
17178 // Warning: we need a move here but no clone is available for LDKMessageHandler
17179 LDKSecretKey our_node_secret_ref;
17180 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
17181 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
17182 unsigned char ephemeral_random_data_arr[32];
17183 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
17184 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
17185 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
17186 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17187 if (logger_conv.free == LDKLogger_JCalls_free) {
17188 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17189 LDKLogger_JCalls_clone(logger_conv.this_arg);
17191 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
17192 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17193 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17194 long ret_ref = (long)ret_var.inner;
17195 if (ret_var.is_owned) {
17201 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
17202 LDKPeerManager this_arg_conv;
17203 this_arg_conv.inner = (void*)(this_arg & (~1));
17204 this_arg_conv.is_owned = false;
17205 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
17206 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17208 for (size_t i = 0; i < ret_var.datalen; i++) {
17209 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
17210 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
17211 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17213 FREE(ret_var.data);
17217 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) {
17218 LDKPeerManager this_arg_conv;
17219 this_arg_conv.inner = (void*)(this_arg & (~1));
17220 this_arg_conv.is_owned = false;
17221 LDKPublicKey their_node_id_ref;
17222 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17223 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17224 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17225 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17226 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17227 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17229 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17230 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
17231 return (long)ret_conv;
17234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17235 LDKPeerManager this_arg_conv;
17236 this_arg_conv.inner = (void*)(this_arg & (~1));
17237 this_arg_conv.is_owned = false;
17238 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17239 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17241 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17243 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17244 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
17245 return (long)ret_conv;
17248 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) {
17249 LDKPeerManager this_arg_conv;
17250 this_arg_conv.inner = (void*)(this_arg & (~1));
17251 this_arg_conv.is_owned = false;
17252 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17253 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17254 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
17255 return (long)ret_conv;
17258 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) {
17259 LDKPeerManager this_arg_conv;
17260 this_arg_conv.inner = (void*)(this_arg & (~1));
17261 this_arg_conv.is_owned = false;
17262 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
17263 LDKu8slice data_ref;
17264 data_ref.datalen = (*env)->GetArrayLength(env, data);
17265 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
17266 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17267 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
17268 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
17269 return (long)ret_conv;
17272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17273 LDKPeerManager this_arg_conv;
17274 this_arg_conv.inner = (void*)(this_arg & (~1));
17275 this_arg_conv.is_owned = false;
17276 PeerManager_process_events(&this_arg_conv);
17279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17280 LDKPeerManager this_arg_conv;
17281 this_arg_conv.inner = (void*)(this_arg & (~1));
17282 this_arg_conv.is_owned = false;
17283 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17284 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
17287 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) {
17288 LDKPeerManager this_arg_conv;
17289 this_arg_conv.inner = (void*)(this_arg & (~1));
17290 this_arg_conv.is_owned = false;
17291 LDKPublicKey node_id_ref;
17292 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17293 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17294 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
17297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
17298 LDKPeerManager this_arg_conv;
17299 this_arg_conv.inner = (void*)(this_arg & (~1));
17300 this_arg_conv.is_owned = false;
17301 PeerManager_timer_tick_occurred(&this_arg_conv);
17304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
17305 unsigned char commitment_seed_arr[32];
17306 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17307 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
17308 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
17309 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17310 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
17314 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) {
17315 LDKPublicKey per_commitment_point_ref;
17316 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17317 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17318 unsigned char base_secret_arr[32];
17319 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
17320 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
17321 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
17322 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17323 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
17324 return (long)ret_conv;
17327 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) {
17328 LDKPublicKey per_commitment_point_ref;
17329 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17330 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17331 LDKPublicKey base_point_ref;
17332 CHECK((*env)->GetArrayLength(env, base_point) == 33);
17333 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
17334 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17335 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
17336 return (long)ret_conv;
17339 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) {
17340 unsigned char per_commitment_secret_arr[32];
17341 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
17342 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
17343 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
17344 unsigned char countersignatory_revocation_base_secret_arr[32];
17345 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
17346 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
17347 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
17348 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17349 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
17350 return (long)ret_conv;
17353 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) {
17354 LDKPublicKey per_commitment_point_ref;
17355 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17356 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17357 LDKPublicKey countersignatory_revocation_base_point_ref;
17358 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
17359 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
17360 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17361 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
17362 return (long)ret_conv;
17365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17366 LDKTxCreationKeys this_obj_conv;
17367 this_obj_conv.inner = (void*)(this_obj & (~1));
17368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17369 TxCreationKeys_free(this_obj_conv);
17372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17373 LDKTxCreationKeys this_ptr_conv;
17374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17375 this_ptr_conv.is_owned = false;
17376 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17377 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
17381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17382 LDKTxCreationKeys this_ptr_conv;
17383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17384 this_ptr_conv.is_owned = false;
17385 LDKPublicKey val_ref;
17386 CHECK((*env)->GetArrayLength(env, val) == 33);
17387 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17388 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
17391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17392 LDKTxCreationKeys this_ptr_conv;
17393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17394 this_ptr_conv.is_owned = false;
17395 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17396 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
17400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17401 LDKTxCreationKeys this_ptr_conv;
17402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17403 this_ptr_conv.is_owned = false;
17404 LDKPublicKey val_ref;
17405 CHECK((*env)->GetArrayLength(env, val) == 33);
17406 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17407 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
17410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17411 LDKTxCreationKeys this_ptr_conv;
17412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17413 this_ptr_conv.is_owned = false;
17414 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17415 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
17419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17420 LDKTxCreationKeys this_ptr_conv;
17421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17422 this_ptr_conv.is_owned = false;
17423 LDKPublicKey val_ref;
17424 CHECK((*env)->GetArrayLength(env, val) == 33);
17425 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17426 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
17429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17430 LDKTxCreationKeys this_ptr_conv;
17431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17432 this_ptr_conv.is_owned = false;
17433 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
17438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17439 LDKTxCreationKeys this_ptr_conv;
17440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17441 this_ptr_conv.is_owned = false;
17442 LDKPublicKey val_ref;
17443 CHECK((*env)->GetArrayLength(env, val) == 33);
17444 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17445 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
17448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17449 LDKTxCreationKeys this_ptr_conv;
17450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17451 this_ptr_conv.is_owned = false;
17452 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
17457 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) {
17458 LDKTxCreationKeys this_ptr_conv;
17459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17460 this_ptr_conv.is_owned = false;
17461 LDKPublicKey val_ref;
17462 CHECK((*env)->GetArrayLength(env, val) == 33);
17463 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17464 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
17467 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) {
17468 LDKPublicKey per_commitment_point_arg_ref;
17469 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17470 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17471 LDKPublicKey revocation_key_arg_ref;
17472 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
17473 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
17474 LDKPublicKey broadcaster_htlc_key_arg_ref;
17475 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
17476 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
17477 LDKPublicKey countersignatory_htlc_key_arg_ref;
17478 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
17479 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
17480 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17481 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
17482 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
17483 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);
17484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17486 long ret_ref = (long)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17494 LDKTxCreationKeys orig_conv;
17495 orig_conv.inner = (void*)(orig & (~1));
17496 orig_conv.is_owned = false;
17497 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17500 long ret_ref = (long)ret_var.inner;
17501 if (ret_var.is_owned) {
17507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17508 LDKTxCreationKeys obj_conv;
17509 obj_conv.inner = (void*)(obj & (~1));
17510 obj_conv.is_owned = false;
17511 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17512 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17513 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17514 CVec_u8Z_free(ret_var);
17518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17519 LDKu8slice ser_ref;
17520 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17521 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17522 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17523 *ret_conv = TxCreationKeys_read(ser_ref);
17524 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17525 return (long)ret_conv;
17528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17529 LDKChannelPublicKeys this_obj_conv;
17530 this_obj_conv.inner = (void*)(this_obj & (~1));
17531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17532 ChannelPublicKeys_free(this_obj_conv);
17535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17536 LDKChannelPublicKeys this_ptr_conv;
17537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17538 this_ptr_conv.is_owned = false;
17539 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17540 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
17544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17545 LDKChannelPublicKeys this_ptr_conv;
17546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17547 this_ptr_conv.is_owned = false;
17548 LDKPublicKey val_ref;
17549 CHECK((*env)->GetArrayLength(env, val) == 33);
17550 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17551 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17555 LDKChannelPublicKeys this_ptr_conv;
17556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17557 this_ptr_conv.is_owned = false;
17558 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17559 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17564 LDKChannelPublicKeys this_ptr_conv;
17565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17566 this_ptr_conv.is_owned = false;
17567 LDKPublicKey val_ref;
17568 CHECK((*env)->GetArrayLength(env, val) == 33);
17569 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17570 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17574 LDKChannelPublicKeys this_ptr_conv;
17575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17576 this_ptr_conv.is_owned = false;
17577 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
17582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17583 LDKChannelPublicKeys this_ptr_conv;
17584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17585 this_ptr_conv.is_owned = false;
17586 LDKPublicKey val_ref;
17587 CHECK((*env)->GetArrayLength(env, val) == 33);
17588 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17589 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17593 LDKChannelPublicKeys this_ptr_conv;
17594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17595 this_ptr_conv.is_owned = false;
17596 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17602 LDKChannelPublicKeys this_ptr_conv;
17603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17604 this_ptr_conv.is_owned = false;
17605 LDKPublicKey val_ref;
17606 CHECK((*env)->GetArrayLength(env, val) == 33);
17607 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17608 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17612 LDKChannelPublicKeys this_ptr_conv;
17613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17614 this_ptr_conv.is_owned = false;
17615 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17616 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17621 LDKChannelPublicKeys this_ptr_conv;
17622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17623 this_ptr_conv.is_owned = false;
17624 LDKPublicKey val_ref;
17625 CHECK((*env)->GetArrayLength(env, val) == 33);
17626 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17627 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
17630 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) {
17631 LDKPublicKey funding_pubkey_arg_ref;
17632 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
17633 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
17634 LDKPublicKey revocation_basepoint_arg_ref;
17635 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
17636 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
17637 LDKPublicKey payment_point_arg_ref;
17638 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
17639 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
17640 LDKPublicKey delayed_payment_basepoint_arg_ref;
17641 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
17642 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
17643 LDKPublicKey htlc_basepoint_arg_ref;
17644 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
17645 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
17646 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);
17647 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17648 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17649 long ret_ref = (long)ret_var.inner;
17650 if (ret_var.is_owned) {
17656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17657 LDKChannelPublicKeys orig_conv;
17658 orig_conv.inner = (void*)(orig & (~1));
17659 orig_conv.is_owned = false;
17660 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
17661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17663 long ret_ref = (long)ret_var.inner;
17664 if (ret_var.is_owned) {
17670 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17671 LDKChannelPublicKeys obj_conv;
17672 obj_conv.inner = (void*)(obj & (~1));
17673 obj_conv.is_owned = false;
17674 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
17675 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17676 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17677 CVec_u8Z_free(ret_var);
17681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17682 LDKu8slice ser_ref;
17683 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17684 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17685 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
17686 *ret_conv = ChannelPublicKeys_read(ser_ref);
17687 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17688 return (long)ret_conv;
17691 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) {
17692 LDKPublicKey per_commitment_point_ref;
17693 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17694 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17695 LDKPublicKey broadcaster_delayed_payment_base_ref;
17696 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
17697 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
17698 LDKPublicKey broadcaster_htlc_base_ref;
17699 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
17700 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
17701 LDKPublicKey countersignatory_revocation_base_ref;
17702 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
17703 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
17704 LDKPublicKey countersignatory_htlc_base_ref;
17705 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
17706 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
17707 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17708 *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);
17709 return (long)ret_conv;
17712 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) {
17713 LDKPublicKey per_commitment_point_ref;
17714 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17715 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17716 LDKChannelPublicKeys broadcaster_keys_conv;
17717 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17718 broadcaster_keys_conv.is_owned = false;
17719 LDKChannelPublicKeys countersignatory_keys_conv;
17720 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17721 countersignatory_keys_conv.is_owned = false;
17722 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
17723 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
17724 return (long)ret_conv;
17727 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) {
17728 LDKPublicKey revocation_key_ref;
17729 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17730 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17731 LDKPublicKey broadcaster_delayed_payment_key_ref;
17732 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17733 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17734 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
17735 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17736 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17737 CVec_u8Z_free(ret_var);
17741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17742 LDKHTLCOutputInCommitment this_obj_conv;
17743 this_obj_conv.inner = (void*)(this_obj & (~1));
17744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17745 HTLCOutputInCommitment_free(this_obj_conv);
17748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
17749 LDKHTLCOutputInCommitment this_ptr_conv;
17750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17751 this_ptr_conv.is_owned = false;
17752 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
17756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17757 LDKHTLCOutputInCommitment this_ptr_conv;
17758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17759 this_ptr_conv.is_owned = false;
17760 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
17763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17764 LDKHTLCOutputInCommitment this_ptr_conv;
17765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17766 this_ptr_conv.is_owned = false;
17767 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
17771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17772 LDKHTLCOutputInCommitment this_ptr_conv;
17773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17774 this_ptr_conv.is_owned = false;
17775 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
17778 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17779 LDKHTLCOutputInCommitment this_ptr_conv;
17780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17781 this_ptr_conv.is_owned = false;
17782 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
17786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17787 LDKHTLCOutputInCommitment this_ptr_conv;
17788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17789 this_ptr_conv.is_owned = false;
17790 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
17793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17794 LDKHTLCOutputInCommitment this_ptr_conv;
17795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17796 this_ptr_conv.is_owned = false;
17797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
17802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17803 LDKHTLCOutputInCommitment this_ptr_conv;
17804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17805 this_ptr_conv.is_owned = false;
17806 LDKThirtyTwoBytes val_ref;
17807 CHECK((*env)->GetArrayLength(env, val) == 32);
17808 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17809 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
17812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17813 LDKHTLCOutputInCommitment orig_conv;
17814 orig_conv.inner = (void*)(orig & (~1));
17815 orig_conv.is_owned = false;
17816 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
17817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17819 long ret_ref = (long)ret_var.inner;
17820 if (ret_var.is_owned) {
17826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
17827 LDKHTLCOutputInCommitment obj_conv;
17828 obj_conv.inner = (void*)(obj & (~1));
17829 obj_conv.is_owned = false;
17830 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
17831 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17832 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17833 CVec_u8Z_free(ret_var);
17837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17838 LDKu8slice ser_ref;
17839 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17840 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17841 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
17842 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
17843 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17844 return (long)ret_conv;
17847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
17848 LDKHTLCOutputInCommitment htlc_conv;
17849 htlc_conv.inner = (void*)(htlc & (~1));
17850 htlc_conv.is_owned = false;
17851 LDKTxCreationKeys keys_conv;
17852 keys_conv.inner = (void*)(keys & (~1));
17853 keys_conv.is_owned = false;
17854 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
17855 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17856 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17857 CVec_u8Z_free(ret_var);
17861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
17862 LDKPublicKey broadcaster_ref;
17863 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
17864 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
17865 LDKPublicKey countersignatory_ref;
17866 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
17867 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
17868 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
17869 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17870 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17871 CVec_u8Z_free(ret_var);
17875 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) {
17876 unsigned char prev_hash_arr[32];
17877 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
17878 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
17879 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
17880 LDKHTLCOutputInCommitment htlc_conv;
17881 htlc_conv.inner = (void*)(htlc & (~1));
17882 htlc_conv.is_owned = false;
17883 LDKPublicKey broadcaster_delayed_payment_key_ref;
17884 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
17885 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
17886 LDKPublicKey revocation_key_ref;
17887 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
17888 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
17889 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
17890 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17891 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17892 Transaction_free(ret_var);
17896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17897 LDKChannelTransactionParameters this_obj_conv;
17898 this_obj_conv.inner = (void*)(this_obj & (~1));
17899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17900 ChannelTransactionParameters_free(this_obj_conv);
17903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
17904 LDKChannelTransactionParameters this_ptr_conv;
17905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17906 this_ptr_conv.is_owned = false;
17907 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
17908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17910 long ret_ref = (long)ret_var.inner;
17911 if (ret_var.is_owned) {
17917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17918 LDKChannelTransactionParameters this_ptr_conv;
17919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17920 this_ptr_conv.is_owned = false;
17921 LDKChannelPublicKeys val_conv;
17922 val_conv.inner = (void*)(val & (~1));
17923 val_conv.is_owned = (val & 1) || (val == 0);
17924 val_conv = ChannelPublicKeys_clone(&val_conv);
17925 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
17928 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17929 LDKChannelTransactionParameters this_ptr_conv;
17930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17931 this_ptr_conv.is_owned = false;
17932 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
17936 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) {
17937 LDKChannelTransactionParameters this_ptr_conv;
17938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17939 this_ptr_conv.is_owned = false;
17940 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
17943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
17944 LDKChannelTransactionParameters this_ptr_conv;
17945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17946 this_ptr_conv.is_owned = false;
17947 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
17951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17952 LDKChannelTransactionParameters this_ptr_conv;
17953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17954 this_ptr_conv.is_owned = false;
17955 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
17958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
17959 LDKChannelTransactionParameters this_ptr_conv;
17960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17961 this_ptr_conv.is_owned = false;
17962 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
17963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17965 long ret_ref = (long)ret_var.inner;
17966 if (ret_var.is_owned) {
17972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17973 LDKChannelTransactionParameters this_ptr_conv;
17974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17975 this_ptr_conv.is_owned = false;
17976 LDKCounterpartyChannelTransactionParameters val_conv;
17977 val_conv.inner = (void*)(val & (~1));
17978 val_conv.is_owned = (val & 1) || (val == 0);
17979 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
17980 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
17983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17984 LDKChannelTransactionParameters this_ptr_conv;
17985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17986 this_ptr_conv.is_owned = false;
17987 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
17988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17990 long ret_ref = (long)ret_var.inner;
17991 if (ret_var.is_owned) {
17997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17998 LDKChannelTransactionParameters this_ptr_conv;
17999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18000 this_ptr_conv.is_owned = false;
18001 LDKOutPoint val_conv;
18002 val_conv.inner = (void*)(val & (~1));
18003 val_conv.is_owned = (val & 1) || (val == 0);
18004 val_conv = OutPoint_clone(&val_conv);
18005 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
18008 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) {
18009 LDKChannelPublicKeys holder_pubkeys_arg_conv;
18010 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
18011 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
18012 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
18013 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
18014 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
18015 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
18016 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
18017 LDKOutPoint funding_outpoint_arg_conv;
18018 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
18019 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
18020 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
18021 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);
18022 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18023 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18024 long ret_ref = (long)ret_var.inner;
18025 if (ret_var.is_owned) {
18031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18032 LDKChannelTransactionParameters orig_conv;
18033 orig_conv.inner = (void*)(orig & (~1));
18034 orig_conv.is_owned = false;
18035 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
18036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18038 long ret_ref = (long)ret_var.inner;
18039 if (ret_var.is_owned) {
18045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18046 LDKCounterpartyChannelTransactionParameters this_obj_conv;
18047 this_obj_conv.inner = (void*)(this_obj & (~1));
18048 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18049 CounterpartyChannelTransactionParameters_free(this_obj_conv);
18052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
18053 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18055 this_ptr_conv.is_owned = false;
18056 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
18057 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18058 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18059 long ret_ref = (long)ret_var.inner;
18060 if (ret_var.is_owned) {
18066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18067 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 LDKChannelPublicKeys val_conv;
18071 val_conv.inner = (void*)(val & (~1));
18072 val_conv.is_owned = (val & 1) || (val == 0);
18073 val_conv = ChannelPublicKeys_clone(&val_conv);
18074 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
18077 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18078 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18080 this_ptr_conv.is_owned = false;
18081 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
18085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18086 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
18092 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) {
18093 LDKChannelPublicKeys pubkeys_arg_conv;
18094 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
18095 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
18096 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
18097 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
18098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18100 long ret_ref = (long)ret_var.inner;
18101 if (ret_var.is_owned) {
18107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18108 LDKCounterpartyChannelTransactionParameters orig_conv;
18109 orig_conv.inner = (void*)(orig & (~1));
18110 orig_conv.is_owned = false;
18111 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
18112 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18113 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18114 long ret_ref = (long)ret_var.inner;
18115 if (ret_var.is_owned) {
18121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
18122 LDKChannelTransactionParameters this_arg_conv;
18123 this_arg_conv.inner = (void*)(this_arg & (~1));
18124 this_arg_conv.is_owned = false;
18125 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
18129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18130 LDKChannelTransactionParameters this_arg_conv;
18131 this_arg_conv.inner = (void*)(this_arg & (~1));
18132 this_arg_conv.is_owned = false;
18133 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
18134 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18135 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18136 long ret_ref = (long)ret_var.inner;
18137 if (ret_var.is_owned) {
18143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18144 LDKChannelTransactionParameters this_arg_conv;
18145 this_arg_conv.inner = (void*)(this_arg & (~1));
18146 this_arg_conv.is_owned = false;
18147 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
18148 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18149 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18150 long ret_ref = (long)ret_var.inner;
18151 if (ret_var.is_owned) {
18157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18158 LDKCounterpartyChannelTransactionParameters obj_conv;
18159 obj_conv.inner = (void*)(obj & (~1));
18160 obj_conv.is_owned = false;
18161 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
18162 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18163 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18164 CVec_u8Z_free(ret_var);
18168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18169 LDKu8slice ser_ref;
18170 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18171 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18172 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
18173 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
18174 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18175 return (long)ret_conv;
18178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18179 LDKChannelTransactionParameters obj_conv;
18180 obj_conv.inner = (void*)(obj & (~1));
18181 obj_conv.is_owned = false;
18182 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
18183 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18184 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18185 CVec_u8Z_free(ret_var);
18189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18190 LDKu8slice ser_ref;
18191 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18192 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18193 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
18194 *ret_conv = ChannelTransactionParameters_read(ser_ref);
18195 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18196 return (long)ret_conv;
18199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18200 LDKDirectedChannelTransactionParameters this_obj_conv;
18201 this_obj_conv.inner = (void*)(this_obj & (~1));
18202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18203 DirectedChannelTransactionParameters_free(this_obj_conv);
18206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18207 LDKDirectedChannelTransactionParameters this_arg_conv;
18208 this_arg_conv.inner = (void*)(this_arg & (~1));
18209 this_arg_conv.is_owned = false;
18210 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
18211 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18212 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18213 long ret_ref = (long)ret_var.inner;
18214 if (ret_var.is_owned) {
18220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18221 LDKDirectedChannelTransactionParameters this_arg_conv;
18222 this_arg_conv.inner = (void*)(this_arg & (~1));
18223 this_arg_conv.is_owned = false;
18224 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
18225 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18226 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18227 long ret_ref = (long)ret_var.inner;
18228 if (ret_var.is_owned) {
18234 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18235 LDKDirectedChannelTransactionParameters this_arg_conv;
18236 this_arg_conv.inner = (void*)(this_arg & (~1));
18237 this_arg_conv.is_owned = false;
18238 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
18242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
18243 LDKDirectedChannelTransactionParameters this_arg_conv;
18244 this_arg_conv.inner = (void*)(this_arg & (~1));
18245 this_arg_conv.is_owned = false;
18246 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
18250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
18251 LDKDirectedChannelTransactionParameters this_arg_conv;
18252 this_arg_conv.inner = (void*)(this_arg & (~1));
18253 this_arg_conv.is_owned = false;
18254 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
18255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18257 long ret_ref = (long)ret_var.inner;
18258 if (ret_var.is_owned) {
18264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18265 LDKHolderCommitmentTransaction this_obj_conv;
18266 this_obj_conv.inner = (void*)(this_obj & (~1));
18267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18268 HolderCommitmentTransaction_free(this_obj_conv);
18271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
18272 LDKHolderCommitmentTransaction this_ptr_conv;
18273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18274 this_ptr_conv.is_owned = false;
18275 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18276 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
18280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18281 LDKHolderCommitmentTransaction this_ptr_conv;
18282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18283 this_ptr_conv.is_owned = false;
18284 LDKSignature val_ref;
18285 CHECK((*env)->GetArrayLength(env, val) == 64);
18286 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18287 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
18290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18291 LDKHolderCommitmentTransaction this_ptr_conv;
18292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18293 this_ptr_conv.is_owned = false;
18294 LDKCVec_SignatureZ val_constr;
18295 val_constr.datalen = (*env)->GetArrayLength(env, val);
18296 if (val_constr.datalen > 0)
18297 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18299 val_constr.data = NULL;
18300 for (size_t i = 0; i < val_constr.datalen; i++) {
18301 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18302 LDKSignature val_conv_8_ref;
18303 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18304 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18305 val_constr.data[i] = val_conv_8_ref;
18307 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
18310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18311 LDKHolderCommitmentTransaction orig_conv;
18312 orig_conv.inner = (void*)(orig & (~1));
18313 orig_conv.is_owned = false;
18314 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
18315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18317 long ret_ref = (long)ret_var.inner;
18318 if (ret_var.is_owned) {
18324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18325 LDKHolderCommitmentTransaction obj_conv;
18326 obj_conv.inner = (void*)(obj & (~1));
18327 obj_conv.is_owned = false;
18328 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
18329 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18330 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18331 CVec_u8Z_free(ret_var);
18335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18336 LDKu8slice ser_ref;
18337 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18338 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18339 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
18340 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
18341 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18342 return (long)ret_conv;
18345 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) {
18346 LDKCommitmentTransaction commitment_tx_conv;
18347 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
18348 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
18349 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
18350 LDKSignature counterparty_sig_ref;
18351 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
18352 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
18353 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
18354 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
18355 if (counterparty_htlc_sigs_constr.datalen > 0)
18356 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18358 counterparty_htlc_sigs_constr.data = NULL;
18359 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
18360 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
18361 LDKSignature counterparty_htlc_sigs_conv_8_ref;
18362 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
18363 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
18364 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
18366 LDKPublicKey holder_funding_key_ref;
18367 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
18368 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
18369 LDKPublicKey counterparty_funding_key_ref;
18370 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
18371 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
18372 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
18373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18375 long ret_ref = (long)ret_var.inner;
18376 if (ret_var.is_owned) {
18382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18383 LDKBuiltCommitmentTransaction this_obj_conv;
18384 this_obj_conv.inner = (void*)(this_obj & (~1));
18385 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18386 BuiltCommitmentTransaction_free(this_obj_conv);
18389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
18390 LDKBuiltCommitmentTransaction this_ptr_conv;
18391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18392 this_ptr_conv.is_owned = false;
18393 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
18394 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18395 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18396 Transaction_free(ret_var);
18400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18401 LDKBuiltCommitmentTransaction this_ptr_conv;
18402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18403 this_ptr_conv.is_owned = false;
18404 LDKTransaction val_ref;
18405 val_ref.datalen = (*env)->GetArrayLength(env, val);
18406 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
18407 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18408 val_ref.data_is_owned = true;
18409 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
18412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18413 LDKBuiltCommitmentTransaction this_ptr_conv;
18414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18415 this_ptr_conv.is_owned = false;
18416 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18417 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
18421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18422 LDKBuiltCommitmentTransaction this_ptr_conv;
18423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18424 this_ptr_conv.is_owned = false;
18425 LDKThirtyTwoBytes val_ref;
18426 CHECK((*env)->GetArrayLength(env, val) == 32);
18427 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18428 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
18431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
18432 LDKTransaction transaction_arg_ref;
18433 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
18434 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
18435 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
18436 transaction_arg_ref.data_is_owned = true;
18437 LDKThirtyTwoBytes txid_arg_ref;
18438 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
18439 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
18440 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18443 long ret_ref = (long)ret_var.inner;
18444 if (ret_var.is_owned) {
18450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18451 LDKBuiltCommitmentTransaction orig_conv;
18452 orig_conv.inner = (void*)(orig & (~1));
18453 orig_conv.is_owned = false;
18454 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18455 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18456 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18457 long ret_ref = (long)ret_var.inner;
18458 if (ret_var.is_owned) {
18464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18465 LDKBuiltCommitmentTransaction obj_conv;
18466 obj_conv.inner = (void*)(obj & (~1));
18467 obj_conv.is_owned = false;
18468 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18469 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18470 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18471 CVec_u8Z_free(ret_var);
18475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18476 LDKu8slice ser_ref;
18477 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18478 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18479 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18480 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18481 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18482 return (long)ret_conv;
18485 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) {
18486 LDKBuiltCommitmentTransaction this_arg_conv;
18487 this_arg_conv.inner = (void*)(this_arg & (~1));
18488 this_arg_conv.is_owned = false;
18489 LDKu8slice funding_redeemscript_ref;
18490 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18491 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18492 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18493 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
18494 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18498 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) {
18499 LDKBuiltCommitmentTransaction this_arg_conv;
18500 this_arg_conv.inner = (void*)(this_arg & (~1));
18501 this_arg_conv.is_owned = false;
18502 unsigned char funding_key_arr[32];
18503 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18504 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
18505 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18506 LDKu8slice funding_redeemscript_ref;
18507 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18508 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18509 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
18511 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18516 LDKCommitmentTransaction this_obj_conv;
18517 this_obj_conv.inner = (void*)(this_obj & (~1));
18518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18519 CommitmentTransaction_free(this_obj_conv);
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18523 LDKCommitmentTransaction orig_conv;
18524 orig_conv.inner = (void*)(orig & (~1));
18525 orig_conv.is_owned = false;
18526 LDKCommitmentTransaction ret_var = CommitmentTransaction_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_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18537 LDKCommitmentTransaction obj_conv;
18538 obj_conv.inner = (void*)(obj & (~1));
18539 obj_conv.is_owned = false;
18540 LDKCVec_u8Z ret_var = CommitmentTransaction_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_CommitmentTransaction_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_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18552 *ret_conv = CommitmentTransaction_read(ser_ref);
18553 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18554 return (long)ret_conv;
18557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
18558 LDKCommitmentTransaction this_arg_conv;
18559 this_arg_conv.inner = (void*)(this_arg & (~1));
18560 this_arg_conv.is_owned = false;
18561 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18566 LDKCommitmentTransaction this_arg_conv;
18567 this_arg_conv.inner = (void*)(this_arg & (~1));
18568 this_arg_conv.is_owned = false;
18569 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
18573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18574 LDKCommitmentTransaction this_arg_conv;
18575 this_arg_conv.inner = (void*)(this_arg & (~1));
18576 this_arg_conv.is_owned = false;
18577 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
18581 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
18582 LDKCommitmentTransaction this_arg_conv;
18583 this_arg_conv.inner = (void*)(this_arg & (~1));
18584 this_arg_conv.is_owned = false;
18585 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
18589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
18590 LDKCommitmentTransaction this_arg_conv;
18591 this_arg_conv.inner = (void*)(this_arg & (~1));
18592 this_arg_conv.is_owned = false;
18593 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
18594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18596 long ret_ref = (long)ret_var.inner;
18597 if (ret_var.is_owned) {
18603 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) {
18604 LDKCommitmentTransaction this_arg_conv;
18605 this_arg_conv.inner = (void*)(this_arg & (~1));
18606 this_arg_conv.is_owned = false;
18607 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18608 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18609 channel_parameters_conv.is_owned = false;
18610 LDKChannelPublicKeys broadcaster_keys_conv;
18611 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18612 broadcaster_keys_conv.is_owned = false;
18613 LDKChannelPublicKeys countersignatory_keys_conv;
18614 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18615 countersignatory_keys_conv.is_owned = false;
18616 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
18617 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
18618 return (long)ret_conv;
18621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18622 LDKTrustedCommitmentTransaction this_obj_conv;
18623 this_obj_conv.inner = (void*)(this_obj & (~1));
18624 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18625 TrustedCommitmentTransaction_free(this_obj_conv);
18628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
18629 LDKTrustedCommitmentTransaction this_arg_conv;
18630 this_arg_conv.inner = (void*)(this_arg & (~1));
18631 this_arg_conv.is_owned = false;
18632 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18633 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
18637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
18638 LDKTrustedCommitmentTransaction this_arg_conv;
18639 this_arg_conv.inner = (void*)(this_arg & (~1));
18640 this_arg_conv.is_owned = false;
18641 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
18642 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18643 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18644 long ret_ref = (long)ret_var.inner;
18645 if (ret_var.is_owned) {
18651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
18652 LDKTrustedCommitmentTransaction this_arg_conv;
18653 this_arg_conv.inner = (void*)(this_arg & (~1));
18654 this_arg_conv.is_owned = false;
18655 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
18656 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18657 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18658 long ret_ref = (long)ret_var.inner;
18659 if (ret_var.is_owned) {
18665 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) {
18666 LDKTrustedCommitmentTransaction this_arg_conv;
18667 this_arg_conv.inner = (void*)(this_arg & (~1));
18668 this_arg_conv.is_owned = false;
18669 unsigned char htlc_base_key_arr[32];
18670 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
18671 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
18672 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
18673 LDKDirectedChannelTransactionParameters channel_parameters_conv;
18674 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
18675 channel_parameters_conv.is_owned = false;
18676 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
18677 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
18678 return (long)ret_conv;
18681 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) {
18682 LDKPublicKey broadcaster_payment_basepoint_ref;
18683 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
18684 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
18685 LDKPublicKey countersignatory_payment_basepoint_ref;
18686 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
18687 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
18688 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
18692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18693 LDKInitFeatures orig_conv;
18694 orig_conv.inner = (void*)(orig & (~1));
18695 orig_conv.is_owned = false;
18696 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
18697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18699 long ret_ref = (long)ret_var.inner;
18700 if (ret_var.is_owned) {
18706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18707 LDKNodeFeatures orig_conv;
18708 orig_conv.inner = (void*)(orig & (~1));
18709 orig_conv.is_owned = false;
18710 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
18711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18713 long ret_ref = (long)ret_var.inner;
18714 if (ret_var.is_owned) {
18720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18721 LDKChannelFeatures orig_conv;
18722 orig_conv.inner = (void*)(orig & (~1));
18723 orig_conv.is_owned = false;
18724 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
18725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18727 long ret_ref = (long)ret_var.inner;
18728 if (ret_var.is_owned) {
18734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18735 LDKInvoiceFeatures orig_conv;
18736 orig_conv.inner = (void*)(orig & (~1));
18737 orig_conv.is_owned = false;
18738 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
18739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18741 long ret_ref = (long)ret_var.inner;
18742 if (ret_var.is_owned) {
18748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18749 LDKInitFeatures this_obj_conv;
18750 this_obj_conv.inner = (void*)(this_obj & (~1));
18751 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18752 InitFeatures_free(this_obj_conv);
18755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18756 LDKNodeFeatures this_obj_conv;
18757 this_obj_conv.inner = (void*)(this_obj & (~1));
18758 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18759 NodeFeatures_free(this_obj_conv);
18762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18763 LDKChannelFeatures this_obj_conv;
18764 this_obj_conv.inner = (void*)(this_obj & (~1));
18765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18766 ChannelFeatures_free(this_obj_conv);
18769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18770 LDKInvoiceFeatures this_obj_conv;
18771 this_obj_conv.inner = (void*)(this_obj & (~1));
18772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18773 InvoiceFeatures_free(this_obj_conv);
18776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
18777 LDKInitFeatures ret_var = InitFeatures_empty();
18778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18780 long ret_ref = (long)ret_var.inner;
18781 if (ret_var.is_owned) {
18787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
18788 LDKInitFeatures ret_var = InitFeatures_known();
18789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18791 long ret_ref = (long)ret_var.inner;
18792 if (ret_var.is_owned) {
18798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
18799 LDKNodeFeatures ret_var = NodeFeatures_empty();
18800 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18801 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18802 long ret_ref = (long)ret_var.inner;
18803 if (ret_var.is_owned) {
18809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
18810 LDKNodeFeatures ret_var = NodeFeatures_known();
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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
18821 LDKChannelFeatures ret_var = ChannelFeatures_empty();
18822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18824 long ret_ref = (long)ret_var.inner;
18825 if (ret_var.is_owned) {
18831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
18832 LDKChannelFeatures ret_var = ChannelFeatures_known();
18833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18835 long ret_ref = (long)ret_var.inner;
18836 if (ret_var.is_owned) {
18842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
18843 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
18844 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18845 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18846 long ret_ref = (long)ret_var.inner;
18847 if (ret_var.is_owned) {
18853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
18854 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
18855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18857 long ret_ref = (long)ret_var.inner;
18858 if (ret_var.is_owned) {
18864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18865 LDKInitFeatures obj_conv;
18866 obj_conv.inner = (void*)(obj & (~1));
18867 obj_conv.is_owned = false;
18868 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
18869 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18870 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18871 CVec_u8Z_free(ret_var);
18875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18876 LDKNodeFeatures obj_conv;
18877 obj_conv.inner = (void*)(obj & (~1));
18878 obj_conv.is_owned = false;
18879 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
18880 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18881 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18882 CVec_u8Z_free(ret_var);
18886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18887 LDKChannelFeatures obj_conv;
18888 obj_conv.inner = (void*)(obj & (~1));
18889 obj_conv.is_owned = false;
18890 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
18891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18893 CVec_u8Z_free(ret_var);
18897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
18898 LDKInvoiceFeatures obj_conv;
18899 obj_conv.inner = (void*)(obj & (~1));
18900 obj_conv.is_owned = false;
18901 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
18902 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18903 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18904 CVec_u8Z_free(ret_var);
18908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18909 LDKu8slice ser_ref;
18910 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18911 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18912 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18913 *ret_conv = InitFeatures_read(ser_ref);
18914 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18915 return (long)ret_conv;
18918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18919 LDKu8slice ser_ref;
18920 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18921 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18922 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18923 *ret_conv = NodeFeatures_read(ser_ref);
18924 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18925 return (long)ret_conv;
18928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18929 LDKu8slice ser_ref;
18930 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18931 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18932 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18933 *ret_conv = ChannelFeatures_read(ser_ref);
18934 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18935 return (long)ret_conv;
18938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18939 LDKu8slice ser_ref;
18940 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18941 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18942 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18943 *ret_conv = InvoiceFeatures_read(ser_ref);
18944 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18945 return (long)ret_conv;
18948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18949 LDKRouteHop this_obj_conv;
18950 this_obj_conv.inner = (void*)(this_obj & (~1));
18951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18952 RouteHop_free(this_obj_conv);
18955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18956 LDKRouteHop this_ptr_conv;
18957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18958 this_ptr_conv.is_owned = false;
18959 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18960 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
18964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18965 LDKRouteHop this_ptr_conv;
18966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18967 this_ptr_conv.is_owned = false;
18968 LDKPublicKey val_ref;
18969 CHECK((*env)->GetArrayLength(env, val) == 33);
18970 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18971 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
18974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18975 LDKRouteHop this_ptr_conv;
18976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18977 this_ptr_conv.is_owned = false;
18978 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
18979 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18980 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18981 long ret_ref = (long)ret_var.inner;
18982 if (ret_var.is_owned) {
18988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18989 LDKRouteHop this_ptr_conv;
18990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18991 this_ptr_conv.is_owned = false;
18992 LDKNodeFeatures val_conv;
18993 val_conv.inner = (void*)(val & (~1));
18994 val_conv.is_owned = (val & 1) || (val == 0);
18995 val_conv = NodeFeatures_clone(&val_conv);
18996 RouteHop_set_node_features(&this_ptr_conv, val_conv);
18999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19000 LDKRouteHop this_ptr_conv;
19001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19002 this_ptr_conv.is_owned = false;
19003 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
19007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19008 LDKRouteHop this_ptr_conv;
19009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19010 this_ptr_conv.is_owned = false;
19011 RouteHop_set_short_channel_id(&this_ptr_conv, val);
19014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19015 LDKRouteHop this_ptr_conv;
19016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19017 this_ptr_conv.is_owned = false;
19018 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
19019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19021 long ret_ref = (long)ret_var.inner;
19022 if (ret_var.is_owned) {
19028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19029 LDKRouteHop this_ptr_conv;
19030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19031 this_ptr_conv.is_owned = false;
19032 LDKChannelFeatures val_conv;
19033 val_conv.inner = (void*)(val & (~1));
19034 val_conv.is_owned = (val & 1) || (val == 0);
19035 val_conv = ChannelFeatures_clone(&val_conv);
19036 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
19039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19040 LDKRouteHop this_ptr_conv;
19041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19042 this_ptr_conv.is_owned = false;
19043 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
19047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19048 LDKRouteHop this_ptr_conv;
19049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19050 this_ptr_conv.is_owned = false;
19051 RouteHop_set_fee_msat(&this_ptr_conv, val);
19054 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19055 LDKRouteHop this_ptr_conv;
19056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19057 this_ptr_conv.is_owned = false;
19058 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
19062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19063 LDKRouteHop this_ptr_conv;
19064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19065 this_ptr_conv.is_owned = false;
19066 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
19069 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) {
19070 LDKPublicKey pubkey_arg_ref;
19071 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
19072 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
19073 LDKNodeFeatures node_features_arg_conv;
19074 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
19075 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
19076 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
19077 LDKChannelFeatures channel_features_arg_conv;
19078 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
19079 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
19080 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
19081 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);
19082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19084 long ret_ref = (long)ret_var.inner;
19085 if (ret_var.is_owned) {
19091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19092 LDKRouteHop orig_conv;
19093 orig_conv.inner = (void*)(orig & (~1));
19094 orig_conv.is_owned = false;
19095 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
19096 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19097 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19098 long ret_ref = (long)ret_var.inner;
19099 if (ret_var.is_owned) {
19105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19106 LDKRoute this_obj_conv;
19107 this_obj_conv.inner = (void*)(this_obj & (~1));
19108 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19109 Route_free(this_obj_conv);
19112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
19113 LDKRoute this_ptr_conv;
19114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19115 this_ptr_conv.is_owned = false;
19116 LDKCVec_CVec_RouteHopZZ val_constr;
19117 val_constr.datalen = (*env)->GetArrayLength(env, val);
19118 if (val_constr.datalen > 0)
19119 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19121 val_constr.data = NULL;
19122 for (size_t m = 0; m < val_constr.datalen; m++) {
19123 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
19124 LDKCVec_RouteHopZ val_conv_12_constr;
19125 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
19126 if (val_conv_12_constr.datalen > 0)
19127 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19129 val_conv_12_constr.data = NULL;
19130 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
19131 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
19132 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
19133 LDKRouteHop val_conv_12_conv_10_conv;
19134 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
19135 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
19136 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
19137 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
19139 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
19140 val_constr.data[m] = val_conv_12_constr;
19142 Route_set_paths(&this_ptr_conv, val_constr);
19145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
19146 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
19147 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
19148 if (paths_arg_constr.datalen > 0)
19149 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19151 paths_arg_constr.data = NULL;
19152 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
19153 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
19154 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
19155 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
19156 if (paths_arg_conv_12_constr.datalen > 0)
19157 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19159 paths_arg_conv_12_constr.data = NULL;
19160 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
19161 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
19162 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
19163 LDKRouteHop paths_arg_conv_12_conv_10_conv;
19164 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
19165 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
19166 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
19167 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
19169 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
19170 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
19172 LDKRoute ret_var = Route_new(paths_arg_constr);
19173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19175 long ret_ref = (long)ret_var.inner;
19176 if (ret_var.is_owned) {
19182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19183 LDKRoute orig_conv;
19184 orig_conv.inner = (void*)(orig & (~1));
19185 orig_conv.is_owned = false;
19186 LDKRoute ret_var = Route_clone(&orig_conv);
19187 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19188 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19189 long ret_ref = (long)ret_var.inner;
19190 if (ret_var.is_owned) {
19196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
19198 obj_conv.inner = (void*)(obj & (~1));
19199 obj_conv.is_owned = false;
19200 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
19201 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19202 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19203 CVec_u8Z_free(ret_var);
19207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19208 LDKu8slice ser_ref;
19209 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19210 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19211 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19212 *ret_conv = Route_read(ser_ref);
19213 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19214 return (long)ret_conv;
19217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19218 LDKRouteHint this_obj_conv;
19219 this_obj_conv.inner = (void*)(this_obj & (~1));
19220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19221 RouteHint_free(this_obj_conv);
19224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19225 LDKRouteHint this_ptr_conv;
19226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19227 this_ptr_conv.is_owned = false;
19228 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19229 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
19233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19234 LDKRouteHint this_ptr_conv;
19235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19236 this_ptr_conv.is_owned = false;
19237 LDKPublicKey val_ref;
19238 CHECK((*env)->GetArrayLength(env, val) == 33);
19239 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19240 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
19243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19244 LDKRouteHint this_ptr_conv;
19245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19246 this_ptr_conv.is_owned = false;
19247 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
19251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19252 LDKRouteHint this_ptr_conv;
19253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19254 this_ptr_conv.is_owned = false;
19255 RouteHint_set_short_channel_id(&this_ptr_conv, val);
19258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19259 LDKRouteHint this_ptr_conv;
19260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19261 this_ptr_conv.is_owned = false;
19262 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
19263 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19264 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19265 long ret_ref = (long)ret_var.inner;
19266 if (ret_var.is_owned) {
19272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19273 LDKRouteHint this_ptr_conv;
19274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19275 this_ptr_conv.is_owned = false;
19276 LDKRoutingFees val_conv;
19277 val_conv.inner = (void*)(val & (~1));
19278 val_conv.is_owned = (val & 1) || (val == 0);
19279 val_conv = RoutingFees_clone(&val_conv);
19280 RouteHint_set_fees(&this_ptr_conv, val_conv);
19283 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19284 LDKRouteHint this_ptr_conv;
19285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19286 this_ptr_conv.is_owned = false;
19287 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
19291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19292 LDKRouteHint this_ptr_conv;
19293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19294 this_ptr_conv.is_owned = false;
19295 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
19298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19299 LDKRouteHint orig_conv;
19300 orig_conv.inner = (void*)(orig & (~1));
19301 orig_conv.is_owned = false;
19302 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
19303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19305 long ret_ref = (long)ret_var.inner;
19306 if (ret_var.is_owned) {
19312 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) {
19313 LDKPublicKey our_node_id_ref;
19314 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
19315 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
19316 LDKNetworkGraph network_conv;
19317 network_conv.inner = (void*)(network & (~1));
19318 network_conv.is_owned = false;
19319 LDKPublicKey payee_ref;
19320 CHECK((*env)->GetArrayLength(env, payee) == 33);
19321 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
19322 LDKInvoiceFeatures payee_features_conv;
19323 payee_features_conv.inner = (void*)(payee_features & (~1));
19324 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
19325 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
19326 LDKCVec_ChannelDetailsZ first_hops_constr;
19327 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
19328 if (first_hops_constr.datalen > 0)
19329 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
19331 first_hops_constr.data = NULL;
19332 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
19333 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
19334 int64_t first_hops_conv_16 = first_hops_vals[q];
19335 LDKChannelDetails first_hops_conv_16_conv;
19336 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
19337 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
19338 first_hops_constr.data[q] = first_hops_conv_16_conv;
19340 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
19341 LDKCVec_RouteHintZ last_hops_constr;
19342 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
19343 if (last_hops_constr.datalen > 0)
19344 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19346 last_hops_constr.data = NULL;
19347 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
19348 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
19349 int64_t last_hops_conv_11 = last_hops_vals[l];
19350 LDKRouteHint last_hops_conv_11_conv;
19351 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
19352 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
19353 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
19354 last_hops_constr.data[l] = last_hops_conv_11_conv;
19356 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
19357 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19358 if (logger_conv.free == LDKLogger_JCalls_free) {
19359 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19360 LDKLogger_JCalls_clone(logger_conv.this_arg);
19362 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
19363 *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);
19364 FREE(first_hops_constr.data);
19365 return (long)ret_conv;
19368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19369 LDKNetworkGraph this_obj_conv;
19370 this_obj_conv.inner = (void*)(this_obj & (~1));
19371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19372 NetworkGraph_free(this_obj_conv);
19375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19376 LDKNetworkGraph orig_conv;
19377 orig_conv.inner = (void*)(orig & (~1));
19378 orig_conv.is_owned = false;
19379 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
19380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19382 long ret_ref = (long)ret_var.inner;
19383 if (ret_var.is_owned) {
19389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19390 LDKLockedNetworkGraph this_obj_conv;
19391 this_obj_conv.inner = (void*)(this_obj & (~1));
19392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19393 LockedNetworkGraph_free(this_obj_conv);
19396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19397 LDKNetGraphMsgHandler this_obj_conv;
19398 this_obj_conv.inner = (void*)(this_obj & (~1));
19399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19400 NetGraphMsgHandler_free(this_obj_conv);
19403 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) {
19404 LDKThirtyTwoBytes genesis_hash_ref;
19405 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19406 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19407 LDKAccess *chain_access_conv_ptr = NULL;
19408 if (chain_access != 0) {
19409 LDKAccess chain_access_conv;
19410 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19411 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19413 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19415 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19416 *chain_access_conv_ptr = chain_access_conv;
19418 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19419 if (logger_conv.free == LDKLogger_JCalls_free) {
19420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19421 LDKLogger_JCalls_clone(logger_conv.this_arg);
19423 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
19424 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19425 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19426 long ret_ref = (long)ret_var.inner;
19427 if (ret_var.is_owned) {
19433 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) {
19434 LDKAccess *chain_access_conv_ptr = NULL;
19435 if (chain_access != 0) {
19436 LDKAccess chain_access_conv;
19437 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19438 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19439 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19440 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19442 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19443 *chain_access_conv_ptr = chain_access_conv;
19445 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19446 if (logger_conv.free == LDKLogger_JCalls_free) {
19447 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19448 LDKLogger_JCalls_clone(logger_conv.this_arg);
19450 LDKNetworkGraph network_graph_conv;
19451 network_graph_conv.inner = (void*)(network_graph & (~1));
19452 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19453 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19454 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
19455 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19456 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19457 long ret_ref = (long)ret_var.inner;
19458 if (ret_var.is_owned) {
19464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
19465 LDKNetGraphMsgHandler this_arg_conv;
19466 this_arg_conv.inner = (void*)(this_arg & (~1));
19467 this_arg_conv.is_owned = false;
19468 LDKAccess *chain_access_conv_ptr = NULL;
19469 if (chain_access != 0) {
19470 LDKAccess chain_access_conv;
19471 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19472 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19473 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19474 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19476 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19477 *chain_access_conv_ptr = chain_access_conv;
19479 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
19482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19483 LDKNetGraphMsgHandler this_arg_conv;
19484 this_arg_conv.inner = (void*)(this_arg & (~1));
19485 this_arg_conv.is_owned = false;
19486 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19489 long ret_ref = (long)ret_var.inner;
19490 if (ret_var.is_owned) {
19496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19497 LDKLockedNetworkGraph this_arg_conv;
19498 this_arg_conv.inner = (void*)(this_arg & (~1));
19499 this_arg_conv.is_owned = false;
19500 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19503 long ret_ref = (long)ret_var.inner;
19504 if (ret_var.is_owned) {
19510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
19511 LDKNetGraphMsgHandler this_arg_conv;
19512 this_arg_conv.inner = (void*)(this_arg & (~1));
19513 this_arg_conv.is_owned = false;
19514 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19515 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
19519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19520 LDKNetGraphMsgHandler this_arg_conv;
19521 this_arg_conv.inner = (void*)(this_arg & (~1));
19522 this_arg_conv.is_owned = false;
19523 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19524 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
19528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19529 LDKDirectionalChannelInfo this_obj_conv;
19530 this_obj_conv.inner = (void*)(this_obj & (~1));
19531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19532 DirectionalChannelInfo_free(this_obj_conv);
19535 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
19536 LDKDirectionalChannelInfo this_ptr_conv;
19537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19538 this_ptr_conv.is_owned = false;
19539 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
19543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19544 LDKDirectionalChannelInfo this_ptr_conv;
19545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19546 this_ptr_conv.is_owned = false;
19547 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
19550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
19551 LDKDirectionalChannelInfo this_ptr_conv;
19552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19553 this_ptr_conv.is_owned = false;
19554 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
19558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19559 LDKDirectionalChannelInfo this_ptr_conv;
19560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19561 this_ptr_conv.is_owned = false;
19562 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
19565 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19566 LDKDirectionalChannelInfo this_ptr_conv;
19567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19568 this_ptr_conv.is_owned = false;
19569 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
19573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19574 LDKDirectionalChannelInfo this_ptr_conv;
19575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19576 this_ptr_conv.is_owned = false;
19577 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19581 LDKDirectionalChannelInfo this_ptr_conv;
19582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19583 this_ptr_conv.is_owned = false;
19584 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
19588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19589 LDKDirectionalChannelInfo this_ptr_conv;
19590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19591 this_ptr_conv.is_owned = false;
19592 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
19595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19596 LDKDirectionalChannelInfo this_ptr_conv;
19597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19598 this_ptr_conv.is_owned = false;
19599 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
19600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19602 long ret_ref = (long)ret_var.inner;
19603 if (ret_var.is_owned) {
19609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19610 LDKDirectionalChannelInfo this_ptr_conv;
19611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19612 this_ptr_conv.is_owned = false;
19613 LDKRoutingFees val_conv;
19614 val_conv.inner = (void*)(val & (~1));
19615 val_conv.is_owned = (val & 1) || (val == 0);
19616 val_conv = RoutingFees_clone(&val_conv);
19617 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
19620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19621 LDKDirectionalChannelInfo this_ptr_conv;
19622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19623 this_ptr_conv.is_owned = false;
19624 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
19625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19627 long ret_ref = (long)ret_var.inner;
19628 if (ret_var.is_owned) {
19634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19635 LDKDirectionalChannelInfo this_ptr_conv;
19636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19637 this_ptr_conv.is_owned = false;
19638 LDKChannelUpdate val_conv;
19639 val_conv.inner = (void*)(val & (~1));
19640 val_conv.is_owned = (val & 1) || (val == 0);
19641 val_conv = ChannelUpdate_clone(&val_conv);
19642 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
19645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19646 LDKDirectionalChannelInfo orig_conv;
19647 orig_conv.inner = (void*)(orig & (~1));
19648 orig_conv.is_owned = false;
19649 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
19650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19652 long ret_ref = (long)ret_var.inner;
19653 if (ret_var.is_owned) {
19659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19660 LDKDirectionalChannelInfo obj_conv;
19661 obj_conv.inner = (void*)(obj & (~1));
19662 obj_conv.is_owned = false;
19663 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
19664 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19665 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19666 CVec_u8Z_free(ret_var);
19670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19671 LDKu8slice ser_ref;
19672 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19673 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19674 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19675 *ret_conv = DirectionalChannelInfo_read(ser_ref);
19676 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19677 return (long)ret_conv;
19680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19681 LDKChannelInfo this_obj_conv;
19682 this_obj_conv.inner = (void*)(this_obj & (~1));
19683 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19684 ChannelInfo_free(this_obj_conv);
19687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19688 LDKChannelInfo this_ptr_conv;
19689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19690 this_ptr_conv.is_owned = false;
19691 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
19692 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19693 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19694 long ret_ref = (long)ret_var.inner;
19695 if (ret_var.is_owned) {
19701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19702 LDKChannelInfo this_ptr_conv;
19703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19704 this_ptr_conv.is_owned = false;
19705 LDKChannelFeatures val_conv;
19706 val_conv.inner = (void*)(val & (~1));
19707 val_conv.is_owned = (val & 1) || (val == 0);
19708 val_conv = ChannelFeatures_clone(&val_conv);
19709 ChannelInfo_set_features(&this_ptr_conv, val_conv);
19712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19713 LDKChannelInfo this_ptr_conv;
19714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19715 this_ptr_conv.is_owned = false;
19716 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19717 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
19721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19722 LDKChannelInfo this_ptr_conv;
19723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19724 this_ptr_conv.is_owned = false;
19725 LDKPublicKey val_ref;
19726 CHECK((*env)->GetArrayLength(env, val) == 33);
19727 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19728 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
19731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19732 LDKChannelInfo this_ptr_conv;
19733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19734 this_ptr_conv.is_owned = false;
19735 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
19736 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19737 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19738 long ret_ref = (long)ret_var.inner;
19739 if (ret_var.is_owned) {
19745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19746 LDKChannelInfo this_ptr_conv;
19747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19748 this_ptr_conv.is_owned = false;
19749 LDKDirectionalChannelInfo val_conv;
19750 val_conv.inner = (void*)(val & (~1));
19751 val_conv.is_owned = (val & 1) || (val == 0);
19752 val_conv = DirectionalChannelInfo_clone(&val_conv);
19753 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
19756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
19757 LDKChannelInfo this_ptr_conv;
19758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19759 this_ptr_conv.is_owned = false;
19760 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
19765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19766 LDKChannelInfo this_ptr_conv;
19767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19768 this_ptr_conv.is_owned = false;
19769 LDKPublicKey val_ref;
19770 CHECK((*env)->GetArrayLength(env, val) == 33);
19771 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19772 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
19775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
19776 LDKChannelInfo this_ptr_conv;
19777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19778 this_ptr_conv.is_owned = false;
19779 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
19780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19782 long ret_ref = (long)ret_var.inner;
19783 if (ret_var.is_owned) {
19789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19790 LDKChannelInfo this_ptr_conv;
19791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19792 this_ptr_conv.is_owned = false;
19793 LDKDirectionalChannelInfo val_conv;
19794 val_conv.inner = (void*)(val & (~1));
19795 val_conv.is_owned = (val & 1) || (val == 0);
19796 val_conv = DirectionalChannelInfo_clone(&val_conv);
19797 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
19800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
19801 LDKChannelInfo this_ptr_conv;
19802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19803 this_ptr_conv.is_owned = false;
19804 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
19805 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19806 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19807 long ret_ref = (long)ret_var.inner;
19808 if (ret_var.is_owned) {
19814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19815 LDKChannelInfo this_ptr_conv;
19816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19817 this_ptr_conv.is_owned = false;
19818 LDKChannelAnnouncement val_conv;
19819 val_conv.inner = (void*)(val & (~1));
19820 val_conv.is_owned = (val & 1) || (val == 0);
19821 val_conv = ChannelAnnouncement_clone(&val_conv);
19822 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
19825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19826 LDKChannelInfo orig_conv;
19827 orig_conv.inner = (void*)(orig & (~1));
19828 orig_conv.is_owned = false;
19829 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19832 long ret_ref = (long)ret_var.inner;
19833 if (ret_var.is_owned) {
19839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
19840 LDKChannelInfo obj_conv;
19841 obj_conv.inner = (void*)(obj & (~1));
19842 obj_conv.is_owned = false;
19843 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19844 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19845 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19846 CVec_u8Z_free(ret_var);
19850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19851 LDKu8slice ser_ref;
19852 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19853 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19854 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19855 *ret_conv = ChannelInfo_read(ser_ref);
19856 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19857 return (long)ret_conv;
19860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19861 LDKRoutingFees this_obj_conv;
19862 this_obj_conv.inner = (void*)(this_obj & (~1));
19863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19864 RoutingFees_free(this_obj_conv);
19867 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19868 LDKRoutingFees this_ptr_conv;
19869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19870 this_ptr_conv.is_owned = false;
19871 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19876 LDKRoutingFees this_ptr_conv;
19877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19878 this_ptr_conv.is_owned = false;
19879 RoutingFees_set_base_msat(&this_ptr_conv, val);
19882 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19883 LDKRoutingFees this_ptr_conv;
19884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19885 this_ptr_conv.is_owned = false;
19886 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19891 LDKRoutingFees this_ptr_conv;
19892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19893 this_ptr_conv.is_owned = false;
19894 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19897 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) {
19898 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19901 long ret_ref = (long)ret_var.inner;
19902 if (ret_var.is_owned) {
19908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19909 LDKRoutingFees orig_conv;
19910 orig_conv.inner = (void*)(orig & (~1));
19911 orig_conv.is_owned = false;
19912 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19915 long ret_ref = (long)ret_var.inner;
19916 if (ret_var.is_owned) {
19922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_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_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19927 *ret_conv = RoutingFees_read(ser_ref);
19928 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19929 return (long)ret_conv;
19932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
19933 LDKRoutingFees obj_conv;
19934 obj_conv.inner = (void*)(obj & (~1));
19935 obj_conv.is_owned = false;
19936 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
19937 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19938 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19939 CVec_u8Z_free(ret_var);
19943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19944 LDKNodeAnnouncementInfo this_obj_conv;
19945 this_obj_conv.inner = (void*)(this_obj & (~1));
19946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19947 NodeAnnouncementInfo_free(this_obj_conv);
19950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19951 LDKNodeAnnouncementInfo this_ptr_conv;
19952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19953 this_ptr_conv.is_owned = false;
19954 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
19955 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19956 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19957 long ret_ref = (long)ret_var.inner;
19958 if (ret_var.is_owned) {
19964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19965 LDKNodeAnnouncementInfo this_ptr_conv;
19966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19967 this_ptr_conv.is_owned = false;
19968 LDKNodeFeatures val_conv;
19969 val_conv.inner = (void*)(val & (~1));
19970 val_conv.is_owned = (val & 1) || (val == 0);
19971 val_conv = NodeFeatures_clone(&val_conv);
19972 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
19975 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
19976 LDKNodeAnnouncementInfo this_ptr_conv;
19977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19978 this_ptr_conv.is_owned = false;
19979 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
19983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19984 LDKNodeAnnouncementInfo this_ptr_conv;
19985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19986 this_ptr_conv.is_owned = false;
19987 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
19990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
19991 LDKNodeAnnouncementInfo this_ptr_conv;
19992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19993 this_ptr_conv.is_owned = false;
19994 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
19995 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
19999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20000 LDKNodeAnnouncementInfo this_ptr_conv;
20001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20002 this_ptr_conv.is_owned = false;
20003 LDKThreeBytes val_ref;
20004 CHECK((*env)->GetArrayLength(env, val) == 3);
20005 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
20006 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
20009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
20010 LDKNodeAnnouncementInfo this_ptr_conv;
20011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20012 this_ptr_conv.is_owned = false;
20013 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20014 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
20018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20019 LDKNodeAnnouncementInfo this_ptr_conv;
20020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20021 this_ptr_conv.is_owned = false;
20022 LDKThirtyTwoBytes val_ref;
20023 CHECK((*env)->GetArrayLength(env, val) == 32);
20024 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20025 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
20028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20029 LDKNodeAnnouncementInfo this_ptr_conv;
20030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20031 this_ptr_conv.is_owned = false;
20032 LDKCVec_NetAddressZ val_constr;
20033 val_constr.datalen = (*env)->GetArrayLength(env, val);
20034 if (val_constr.datalen > 0)
20035 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20037 val_constr.data = NULL;
20038 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20039 for (size_t m = 0; m < val_constr.datalen; m++) {
20040 int64_t val_conv_12 = val_vals[m];
20041 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
20042 FREE((void*)val_conv_12);
20043 val_constr.data[m] = val_conv_12_conv;
20045 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20046 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
20049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
20050 LDKNodeAnnouncementInfo this_ptr_conv;
20051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20052 this_ptr_conv.is_owned = false;
20053 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
20054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20056 long ret_ref = (long)ret_var.inner;
20057 if (ret_var.is_owned) {
20063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20064 LDKNodeAnnouncementInfo this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 LDKNodeAnnouncement val_conv;
20068 val_conv.inner = (void*)(val & (~1));
20069 val_conv.is_owned = (val & 1) || (val == 0);
20070 val_conv = NodeAnnouncement_clone(&val_conv);
20071 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
20074 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) {
20075 LDKNodeFeatures features_arg_conv;
20076 features_arg_conv.inner = (void*)(features_arg & (~1));
20077 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20078 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
20079 LDKThreeBytes rgb_arg_ref;
20080 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
20081 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
20082 LDKThirtyTwoBytes alias_arg_ref;
20083 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
20084 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
20085 LDKCVec_NetAddressZ addresses_arg_constr;
20086 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
20087 if (addresses_arg_constr.datalen > 0)
20088 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20090 addresses_arg_constr.data = NULL;
20091 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
20092 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
20093 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
20094 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
20095 FREE((void*)addresses_arg_conv_12);
20096 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
20098 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
20099 LDKNodeAnnouncement announcement_message_arg_conv;
20100 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
20101 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
20102 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
20103 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
20104 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20105 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20106 long ret_ref = (long)ret_var.inner;
20107 if (ret_var.is_owned) {
20113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20114 LDKNodeAnnouncementInfo orig_conv;
20115 orig_conv.inner = (void*)(orig & (~1));
20116 orig_conv.is_owned = false;
20117 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
20118 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20119 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20120 long ret_ref = (long)ret_var.inner;
20121 if (ret_var.is_owned) {
20127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20128 LDKNodeAnnouncementInfo obj_conv;
20129 obj_conv.inner = (void*)(obj & (~1));
20130 obj_conv.is_owned = false;
20131 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
20132 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20133 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20134 CVec_u8Z_free(ret_var);
20138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20139 LDKu8slice ser_ref;
20140 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20141 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20142 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20143 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
20144 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20145 return (long)ret_conv;
20148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20149 LDKNodeInfo this_obj_conv;
20150 this_obj_conv.inner = (void*)(this_obj & (~1));
20151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20152 NodeInfo_free(this_obj_conv);
20155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20156 LDKNodeInfo this_ptr_conv;
20157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20158 this_ptr_conv.is_owned = false;
20159 LDKCVec_u64Z val_constr;
20160 val_constr.datalen = (*env)->GetArrayLength(env, val);
20161 if (val_constr.datalen > 0)
20162 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20164 val_constr.data = NULL;
20165 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20166 for (size_t g = 0; g < val_constr.datalen; g++) {
20167 int64_t val_conv_6 = val_vals[g];
20168 val_constr.data[g] = val_conv_6;
20170 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20171 NodeInfo_set_channels(&this_ptr_conv, val_constr);
20174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
20175 LDKNodeInfo this_ptr_conv;
20176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20177 this_ptr_conv.is_owned = false;
20178 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
20179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20181 long ret_ref = (long)ret_var.inner;
20182 if (ret_var.is_owned) {
20188 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) {
20189 LDKNodeInfo this_ptr_conv;
20190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20191 this_ptr_conv.is_owned = false;
20192 LDKRoutingFees val_conv;
20193 val_conv.inner = (void*)(val & (~1));
20194 val_conv.is_owned = (val & 1) || (val == 0);
20195 val_conv = RoutingFees_clone(&val_conv);
20196 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
20199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
20200 LDKNodeInfo this_ptr_conv;
20201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20202 this_ptr_conv.is_owned = false;
20203 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
20204 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20205 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20206 long ret_ref = (long)ret_var.inner;
20207 if (ret_var.is_owned) {
20213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20214 LDKNodeInfo this_ptr_conv;
20215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20216 this_ptr_conv.is_owned = false;
20217 LDKNodeAnnouncementInfo val_conv;
20218 val_conv.inner = (void*)(val & (~1));
20219 val_conv.is_owned = (val & 1) || (val == 0);
20220 val_conv = NodeAnnouncementInfo_clone(&val_conv);
20221 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
20224 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) {
20225 LDKCVec_u64Z channels_arg_constr;
20226 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
20227 if (channels_arg_constr.datalen > 0)
20228 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20230 channels_arg_constr.data = NULL;
20231 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
20232 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
20233 int64_t channels_arg_conv_6 = channels_arg_vals[g];
20234 channels_arg_constr.data[g] = channels_arg_conv_6;
20236 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
20237 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
20238 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
20239 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
20240 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
20241 LDKNodeAnnouncementInfo announcement_info_arg_conv;
20242 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
20243 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
20244 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
20245 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
20246 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20247 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20248 long ret_ref = (long)ret_var.inner;
20249 if (ret_var.is_owned) {
20255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20256 LDKNodeInfo orig_conv;
20257 orig_conv.inner = (void*)(orig & (~1));
20258 orig_conv.is_owned = false;
20259 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
20260 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20261 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20262 long ret_ref = (long)ret_var.inner;
20263 if (ret_var.is_owned) {
20269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20270 LDKNodeInfo obj_conv;
20271 obj_conv.inner = (void*)(obj & (~1));
20272 obj_conv.is_owned = false;
20273 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
20274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20276 CVec_u8Z_free(ret_var);
20280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20281 LDKu8slice ser_ref;
20282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20284 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20285 *ret_conv = NodeInfo_read(ser_ref);
20286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20287 return (long)ret_conv;
20290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
20291 LDKNetworkGraph obj_conv;
20292 obj_conv.inner = (void*)(obj & (~1));
20293 obj_conv.is_owned = false;
20294 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
20295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20297 CVec_u8Z_free(ret_var);
20301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20302 LDKu8slice ser_ref;
20303 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20304 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20305 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20306 *ret_conv = NetworkGraph_read(ser_ref);
20307 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20308 return (long)ret_conv;
20311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
20312 LDKThirtyTwoBytes genesis_hash_ref;
20313 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
20314 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
20315 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
20316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20318 long ret_ref = (long)ret_var.inner;
20319 if (ret_var.is_owned) {
20325 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) {
20326 LDKNetworkGraph this_arg_conv;
20327 this_arg_conv.inner = (void*)(this_arg & (~1));
20328 this_arg_conv.is_owned = false;
20329 LDKNodeAnnouncement msg_conv;
20330 msg_conv.inner = (void*)(msg & (~1));
20331 msg_conv.is_owned = false;
20332 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20333 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
20334 return (long)ret_conv;
20337 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) {
20338 LDKNetworkGraph this_arg_conv;
20339 this_arg_conv.inner = (void*)(this_arg & (~1));
20340 this_arg_conv.is_owned = false;
20341 LDKUnsignedNodeAnnouncement msg_conv;
20342 msg_conv.inner = (void*)(msg & (~1));
20343 msg_conv.is_owned = false;
20344 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20345 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
20346 return (long)ret_conv;
20349 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) {
20350 LDKNetworkGraph this_arg_conv;
20351 this_arg_conv.inner = (void*)(this_arg & (~1));
20352 this_arg_conv.is_owned = false;
20353 LDKChannelAnnouncement msg_conv;
20354 msg_conv.inner = (void*)(msg & (~1));
20355 msg_conv.is_owned = false;
20356 LDKAccess *chain_access_conv_ptr = NULL;
20357 if (chain_access != 0) {
20358 LDKAccess chain_access_conv;
20359 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20360 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20362 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20364 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20365 *chain_access_conv_ptr = chain_access_conv;
20367 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20368 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20369 return (long)ret_conv;
20372 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) {
20373 LDKNetworkGraph this_arg_conv;
20374 this_arg_conv.inner = (void*)(this_arg & (~1));
20375 this_arg_conv.is_owned = false;
20376 LDKUnsignedChannelAnnouncement msg_conv;
20377 msg_conv.inner = (void*)(msg & (~1));
20378 msg_conv.is_owned = false;
20379 LDKAccess *chain_access_conv_ptr = NULL;
20380 if (chain_access != 0) {
20381 LDKAccess chain_access_conv;
20382 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20383 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20384 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20385 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20387 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20388 *chain_access_conv_ptr = chain_access_conv;
20390 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20391 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20392 return (long)ret_conv;
20395 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) {
20396 LDKNetworkGraph this_arg_conv;
20397 this_arg_conv.inner = (void*)(this_arg & (~1));
20398 this_arg_conv.is_owned = false;
20399 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20403 LDKNetworkGraph this_arg_conv;
20404 this_arg_conv.inner = (void*)(this_arg & (~1));
20405 this_arg_conv.is_owned = false;
20406 LDKChannelUpdate msg_conv;
20407 msg_conv.inner = (void*)(msg & (~1));
20408 msg_conv.is_owned = false;
20409 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20410 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20411 return (long)ret_conv;
20414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20415 LDKNetworkGraph this_arg_conv;
20416 this_arg_conv.inner = (void*)(this_arg & (~1));
20417 this_arg_conv.is_owned = false;
20418 LDKUnsignedChannelUpdate msg_conv;
20419 msg_conv.inner = (void*)(msg & (~1));
20420 msg_conv.is_owned = false;
20421 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20422 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
20423 return (long)ret_conv;